1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
--- a/modules/misc/inhibit/xdg.c 2013-06-24 20:00:38.000000000 +0200
+++ b/modules/misc/inhibit/xdg.c 2013-09-26 13:43:21.819782562 +0200
@@ -28,7 +28,11 @@
#include <assert.h>
#include <errno.h>
#include <signal.h>
-#include <spawn.h>
+#if !defined(_POSIX_SPAWN)
+# define _POSIX_SPAWN -1
+#else
+# include <spawn.h>
+#endif
#include <sys/wait.h>
static int Open (vlc_object_t *);
@@ -46,7 +50,9 @@
struct vlc_inhibit_sys
{
vlc_timer_t timer;
+#if (_POSIX_SPAWN >= 0)
posix_spawnattr_t attr;
+#endif
};
extern char **environ;
@@ -91,6 +97,7 @@
if (p_sys == NULL)
return VLC_ENOMEM;
+#if (_POSIX_SPAWN >= 0)
posix_spawnattr_init (&p_sys->attr);
/* Reset signal handlers to default and clear mask in the child process */
{
@@ -102,12 +109,15 @@
posix_spawnattr_setsigdefault (&p_sys->attr, &set);
posix_spawnattr_setflags (&p_sys->attr, POSIX_SPAWN_SETSIGDEF
| POSIX_SPAWN_SETSIGMASK);
+#endif
}
ih->p_sys = p_sys;
if (vlc_timer_create (&p_sys->timer, Timer, ih))
{
+#if (_POSIX_SPAWN >= 0)
posix_spawnattr_destroy (&p_sys->attr);
+#endif
free (p_sys);
return VLC_ENOMEM;
}
@@ -122,6 +132,8 @@
vlc_inhibit_sys_t *p_sys = ih->p_sys;
vlc_timer_destroy (p_sys->timer);
+#if (_POSIX_SPAWN >= 0)
posix_spawnattr_destroy (&p_sys->attr);
+#endif
free (p_sys);
}
|