Opened 12 years ago

Closed 12 years ago

#4979 closed Bugs (fixed)

shared_memory_object open_only ctor resets permissions to default

Reported by: Bob Dempsey <rdempsey@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc:

Description

Because of a call to ::fchmod() in shared_memory_object::priv_open_or_create, if you use attempt to open a shm segment using the open_only tag, you will always reset the existing perms to the default. These 3 lines are the problem:

   if(m_handle >= 0){
      ::fchmod(m_handle, perm.get_permissions());
   }

If you delete these lines (on Linux, anyway) things looks right. I don't know why those lines are there, but if they are needed for portability, perhaps something like

   if(m_handle >= 0 && type != detail::DoOpen){
      ::fchmod(m_handle, perm.get_permissions());
   }

might work better.

Change History (1)

comment:1 by Ion Gaztañaga, 12 years ago

Resolution: fixed
Status: newclosed

Updated SVN code. Permissions updated only when the shm is created. Thanks for the report.

Note: See TracTickets for help on using tickets.