Boost logo

Boost Users :

Subject: [Boost-users] [Interprocess] Growing resets permissions
From: Aaron_Wright_at_[hidden]
Date: 2012-09-10 12:28:05


        I have a situation where I don't know how much shared memory I
need, so I made the shared memory grow when it ran out of space. My shared
memory is shared between a process running as root and postgres, which
won't run as root. So I set the permissions to unrestricted (0666) when I
create the shared memory. My problem is that when I grow the shared
memory, the permissions are reset to (0644). This breaks things, as
postgres can no longer open the shared memory for writing.

        I followed the code a bit and saw that it was using ftruncate.
Checking the man page for ftruncate reveals, "the set-user-ID and
set-group-ID permission bits may be cleared."

        Has anyone else ran into this? What is the easy solution? Should I
just set the permissions manually after growing? Is this a bug in the
interprocess library?

---
Aaron Wright

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net