Opened 7 years ago

Closed 7 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:


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.

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.