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 14:45:13.069727587 +0200 @@ -28,7 +28,11 @@ #include #include #include -#include +#if !defined(_POSIX_SPAWN) +# define _POSIX_SPAWN -1 +#else +# include +#endif #include 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; @@ -60,8 +66,12 @@ static void Timer (void *data) }; pid_t pid; +#if (_POSIX_SPAWN >= 0) int err = posix_spawnp (&pid, "xdg-screensaver", NULL, &sys->attr, argv, environ); +#else + int err; +#endif if (err == 0) { int status; @@ -91,6 +101,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 */ { @@ -103,11 +114,14 @@ static int Open (vlc_object_t *obj) 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 +136,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 #include #include +#if !defined(_POSIX_SPAWN) +# define _POSIX_SPAWN -1 +#else #include +#endif #include 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)