aboutsummaryrefslogtreecommitdiffstats
path: root/main/vlc/uclibc-inhibit-spawn.patch
blob: 9c7e72ed66f4e00148a2b7cec3045d1217f7ae27 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
diff -rupN a/modules/misc/inhibit/xdg.c b/modules/misc/inhibit/xdg.c
--- a/modules/misc/inhibit/xdg.c	2013-06-24 20:00:38.000000000 +0200
+++ b/modules/misc/inhibit/xdg.c	2013-09-26 13:57:19.839770148 +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 @@ vlc_module_end ()
 struct vlc_inhibit_sys
 {
     vlc_timer_t timer;
+#if (_POSIX_SPAWN >= 0)
     posix_spawnattr_t attr;
+#endif
 };
 
 extern char **environ;
@@ -91,6 +97,7 @@ static int Open (vlc_object_t *obj)
     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 @@ static int Open (vlc_object_t *obj)
         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 @@ static void Close (vlc_object_t *obj)
     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);
 }
diff -rupN a/src/posix/netconf.c b/src/posix/netconf.c
--- a/src/posix/netconf.c	2013-06-24 20:00:39.000000000 +0200
+++ b/src/posix/netconf.c	2013-09-26 13:56:46.149770648 +0200
@@ -29,7 +29,11 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <fcntl.h>
+#if !defined(_POSIX_SPAWN)                                                     
+# define _POSIX_SPAWN -1                                                       
+#else 
 #include <spawn.h>
+#endif
 #include <unistd.h>
 
 extern char **environ;
@@ -47,36 +51,45 @@ char *vlc_getProxyUrl(const char *url)
 {
     /* libproxy helper */
     pid_t pid;
+#if (_POSIX_SPAWN >= 0)
     posix_spawn_file_actions_t actions;
     posix_spawnattr_t attr;
+#endif
     char *argv[3] = { (char *)"proxy", (char *)url, NULL };
     int fd[2];
 
     if (vlc_pipe(fd))
         return NULL;
 
+#if (_POSIX_SPAWN >= 0)
     posix_spawn_file_actions_init(&actions);
     posix_spawn_file_actions_addopen(&actions, STDIN_FILENO, "/dev/null",
                                      O_RDONLY, 0644);
     posix_spawn_file_actions_adddup2(&actions, fd[1], STDOUT_FILENO);
 
     posix_spawnattr_init(&attr);
+#endif
     {
         sigset_t set;
 
         sigemptyset(&set);
+#if (_POSIX_SPAWN >= 0)
         posix_spawnattr_setsigmask(&attr, &set);
+#endif
         sigaddset (&set, SIGPIPE);
+#if (_POSIX_SPAWN >= 0)
         posix_spawnattr_setsigdefault(&attr, &set);
         posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETSIGDEF
                                       | POSIX_SPAWN_SETSIGMASK);
+#endif
     }
-
+#if (_POSIX_SPAWN >= 0)
     if (posix_spawnp(&pid, "proxy", &actions, &attr, argv, environ))
         pid = -1;
 
     posix_spawnattr_destroy(&attr);
     posix_spawn_file_actions_destroy(&actions);
+#endif
     close(fd[1]);
 
     if (pid != -1)