summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2013-04-09 11:32:20 +0300
committerTanu Kaskinen <tanuk@iki.fi>2013-04-10 14:31:54 +0300
commitd646d931dc52e21266687cc748961fe2323f4467 (patch)
tree8bc9b29364c22e920d0814f0758e0af09ebb793a
parentb4342845db2bec59f9e486202bf02a9fb1dd10e8 (diff)
shm: Don't force the shm files to be read-only
Forcing the shm file to be read-only makes shm_unlink() fail on OS X. Thanks to Albert Zeyer for reporting the bug and investigating the root cause. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=62988
-rw-r--r--src/pulsecore/shm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c
index 9f44df374..8aa34faf3 100644
--- a/src/pulsecore/shm.c
+++ b/src/pulsecore/shm.c
@@ -111,6 +111,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
pa_assert(m);
pa_assert(size > 0);
pa_assert(size <= MAX_SHM_SIZE);
+ pa_assert(!(mode & ~0777));
pa_assert(mode >= 0600);
/* Each time we create a new SHM area, let's first drop all stale
@@ -151,7 +152,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) {
pa_random(&m->id, sizeof(m->id));
segment_name(fn, sizeof(fn), m->id);
- if ((fd = shm_open(fn, O_RDWR|O_CREAT|O_EXCL, mode & 0444)) < 0) {
+ if ((fd = shm_open(fn, O_RDWR|O_CREAT|O_EXCL, mode)) < 0) {
pa_log("shm_open() failed: %s", pa_cstrerror(errno));
goto fail;
}