main/vlc: inhibit spawn in posix/netconf.c

parent d56045fe
......@@ -222,10 +222,10 @@ daemon() {
md5sums="8c77bda671821f5b9ede96b6816e2ade vlc-2.1.0.tar.xz
350b30698eb784def7d19446eb1d6c81 vlc.trigger
01e503127fceed639185232f4e094725 uclibc-inhibit-spawn.patch"
0c3aef5d1e0884b808c621267c07c61c uclibc-inhibit-spawn.patch"
sha256sums="d2177daa31786acf1e961b2f63429797a8c62c090e5359bcc7929a1ba5fe41f7 vlc-2.1.0.tar.xz
0639c022dc844fad95eb0246b1d24557641939bbda91af0c700374378d8f054a vlc.trigger
65bf43e2b536aba2f176497f7e5b82298567b94dd6d94b6468affbda05c2f045 uclibc-inhibit-spawn.patch"
284db26a640d1f53d343582449f9589521ca14f018f9b2ecb3d0de9ae13908a0 uclibc-inhibit-spawn.patch"
sha512sums="abf397e1382289d579fec3dc540885c45ba055f158f7c248c5de27a7c50dac5a4c317145c4a786ed3819a9199fc304fa8f43ccde8c33c2938d40c805e7e9b124 vlc-2.1.0.tar.xz
a081dd93248b63724ffb65cde0a00db0e1f3b9a1d47074800d898e39dc71c074b3dd3fa18e5fbc45fa90376e7df6d7ef8689c4253c1d9405868a3f8bbd76adcc vlc.trigger
b53ddec0a6f571534a86df698f7b101d5671bb0700783daef710fa7a0d5370dcf9f82540775c782858f5ec8f052e2fefa1d07a723e7aa71b5ec62cf2177a2376 uclibc-inhibit-spawn.patch"
1435e339d2b831ed8e88fcacf7d672fc61229b8d4478e1d2ef6a51c865e35ed82c18f304acbad16762476f8821e5547f484f210400e10fff36c9f97aa9d557e0 uclibc-inhibit-spawn.patch"
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:43:21.819782562 +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>
......@@ -13,7 +14,7 @@
#include <sys/wait.h>
static int Open (vlc_object_t *);
@@ -46,7 +50,9 @@
@@ -46,7 +50,9 @@ vlc_module_end ()
struct vlc_inhibit_sys
{
vlc_timer_t timer;
......@@ -23,7 +24,7 @@
};
extern char **environ;
@@ -91,6 +97,7 @@
@@ -91,6 +97,7 @@ static int Open (vlc_object_t *obj)
if (p_sys == NULL)
return VLC_ENOMEM;
......@@ -31,7 +32,7 @@
posix_spawnattr_init (&p_sys->attr);
/* Reset signal handlers to default and clear mask in the child process */
{
@@ -102,12 +109,15 @@
@@ -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);
......@@ -47,7 +48,7 @@
free (p_sys);
return VLC_ENOMEM;
}
@@ -122,6 +132,8 @@
@@ -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);
......@@ -56,3 +57,65 @@
+#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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment