Modify

Ticket #4979 (closed Bugs: fixed)

Opened 3 years ago

Last modified 3 years ago

shared_memory_object open_only ctor resets permissions to default

Reported by: Bob Dempsey <rdempsey@…> Owned by: igaztanaga
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.

Attachments

Change History

comment:1 Changed 3 years ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to fixed

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.