diff options
author | David Henningsson <david.henningsson@canonical.com> | 2015-09-28 15:41:15 +0200 |
---|---|---|
committer | Arun Raghavan <git@arunraghavan.net> | 2015-10-30 17:52:15 +0530 |
commit | 9c6541e84dda1cf2b89fc97f568c2ad4f5ae8ae4 (patch) | |
tree | eced15e91d13892da10d01d378849da44c221a70 | |
parent | 42f6f3080c5c74f5a8819fb808c601dc4f6c8c38 (diff) | |
download | pulseaudio-9c6541e84dda1cf2b89fc97f568c2ad4f5ae8ae4.tar.gz |
shm: Warn on not being able to open shm files
With the exception of when trying to clean up shm files,
it's useful to warn if opening them fails, regardless of reason.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
-rw-r--r-- | src/pulsecore/shm.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c index eefd7ba0a..d6131688c 100644 --- a/src/pulsecore/shm.c +++ b/src/pulsecore/shm.c @@ -288,7 +288,7 @@ void pa_shm_punch(pa_shm *m, size_t offset, size_t size) { #ifdef HAVE_SHM_OPEN -int pa_shm_attach(pa_shm *m, unsigned id, bool writable) { +static int shm_attach(pa_shm *m, unsigned id, bool writable, bool for_cleanup) { char fn[32]; int fd = -1; int prot; @@ -299,7 +299,7 @@ int pa_shm_attach(pa_shm *m, unsigned id, bool writable) { segment_name(fn, sizeof(fn), m->id = id); if ((fd = shm_open(fn, writable ? O_RDWR : O_RDONLY, 0)) < 0) { - if (errno != EACCES && errno != ENOENT) + if ((errno != EACCES && errno != ENOENT) || !for_cleanup) pa_log("shm_open() failed: %s", pa_cstrerror(errno)); goto fail; } @@ -338,6 +338,10 @@ fail: return -1; } +int pa_shm_attach(pa_shm *m, unsigned id, bool writable) { + return shm_attach(m, id, writable, false); +} + #else /* HAVE_SHM_OPEN */ int pa_shm_attach(pa_shm *m, unsigned id, bool writable) { @@ -375,7 +379,7 @@ int pa_shm_cleanup(void) { if (pa_atou(de->d_name + SHM_ID_LEN, &id) < 0) continue; - if (pa_shm_attach(&seg, id, false) < 0) + if (shm_attach(&seg, id, false, true) < 0) continue; if (seg.size < SHM_MARKER_SIZE) { |