cb608474eb4f3be1186f1c3bcaa3d0cee692b668
[openwrt/svn-archive/archive.git] / sound / pulseaudio / patches / 002-shm_unlink.patch
1 Index: pulseaudio-0.9.10/src/pulsecore/shm.c
2 ===================================================================
3 --- pulseaudio-0.9.10.orig/src/pulsecore/shm.c 2008-04-11 13:28:12.000000000 +0200
4 +++ pulseaudio-0.9.10/src/pulsecore/shm.c 2008-04-11 13:28:13.000000000 +0200
5 @@ -125,7 +125,7 @@
6 m->do_unlink = 0;
7
8 } else {
9 -#ifdef HAVE_SHM_OPEN
10 +#ifdef HAVE_SHM_UNLINK
11 struct shm_marker *marker;
12
13 pa_random(&m->id, sizeof(m->id));
14 @@ -167,7 +167,7 @@
15
16 fail:
17
18 -#ifdef HAVE_SHM_OPEN
19 +#ifdef HAVE_SHM_UNLINK
20 if (fd >= 0) {
21 shm_unlink(fn);
22 pa_close(fd);
23 @@ -196,7 +196,7 @@
24 pa_xfree(m->ptr);
25 #endif
26 } else {
27 -#ifdef HAVE_SHM_OPEN
28 +#ifdef HAVE_SHM_UNLINK
29 if (munmap(m->ptr, m->size) < 0)
30 pa_log("munmap() failed: %s", pa_cstrerror(errno));
31
32 @@ -260,7 +260,7 @@
33 #endif
34 }
35
36 -#ifdef HAVE_SHM_OPEN
37 +#ifdef HAVE_SHM_UNLINK
38
39 int pa_shm_attach_ro(pa_shm *m, unsigned id) {
40 char fn[32];
41 @@ -318,7 +318,7 @@
42
43 int pa_shm_cleanup(void) {
44
45 -#ifdef HAVE_SHM_OPEN
46 +#ifdef HAVE_SHM_UNLINK
47 #ifdef SHM_PATH
48 DIR *d;
49 struct dirent *de;
50 @@ -371,8 +371,10 @@
51 /* Ok, the owner of this shms segment is dead, so, let's remove the segment */
52 segment_name(fn, sizeof(fn), id);
53
54 +#ifdef HAVE_SHM_UNLINK
55 if (shm_unlink(fn) < 0 && errno != EACCES)
56 pa_log_warn("Failed to remove SHM segment %s: %s\n", fn, pa_cstrerror(errno));
57 +#endif
58 }
59
60 closedir(d);