diff options
author | jsa <jsa@FreeBSD.org> | 2010-11-24 01:25:58 +0800 |
---|---|---|
committer | jsa <jsa@FreeBSD.org> | 2010-11-24 01:25:58 +0800 |
commit | 595917aeb69850b885bd5b467227fd44a51e52a8 (patch) | |
tree | e5c57362a2bad8fa5498c08e7ad963647087f0d8 /multimedia | |
parent | 8056ca3b4b440066f54db9d8b4e9e700e574f3cc (diff) | |
download | freebsd-ports-gnome-595917aeb69850b885bd5b467227fd44a51e52a8.tar.gz freebsd-ports-gnome-595917aeb69850b885bd5b467227fd44a51e52a8.tar.zst freebsd-ports-gnome-595917aeb69850b885bd5b467227fd44a51e52a8.zip |
Update xscreensaver.c patch to fix build on 7.x.
PR: ports/152412
Submitted by: Martin Birgmeier <martin.birgmeier@aon.at>
Approved by: kwm (mentor)
Diffstat (limited to 'multimedia')
-rw-r--r-- | multimedia/vlc/files/extra-patch-modules__misc__inhibit__xscreensaver.c | 123 |
1 files changed, 98 insertions, 25 deletions
diff --git a/multimedia/vlc/files/extra-patch-modules__misc__inhibit__xscreensaver.c b/multimedia/vlc/files/extra-patch-modules__misc__inhibit__xscreensaver.c index 02e34095006f..bb57051bf5d6 100644 --- a/multimedia/vlc/files/extra-patch-modules__misc__inhibit__xscreensaver.c +++ b/multimedia/vlc/files/extra-patch-modules__misc__inhibit__xscreensaver.c @@ -1,25 +1,98 @@ ---- ./modules/misc/inhibit/xscreensaver.c.orig 2010-07-10 19:56:49.000000000 -0400 -+++ ./modules/misc/inhibit/xscreensaver.c 2010-07-10 20:05:33.000000000 -0400 -@@ -39,7 +39,6 @@ - #include <sys/wait.h> - #include <fcntl.h> - #include <signal.h> --#include <spawn.h> - - /***************************************************************************** - * Local prototypes -@@ -133,14 +132,6 @@ - *****************************************************************************/ - static void Execute (vlc_inhibit_t *p_ih, const char *const *argv) - { -- vlc_inhibit_sys_t *p_sys = p_ih->p_sys; -- pid_t pid; -- -- if (posix_spawnp (&pid, argv[0], &p_sys->actions, &p_sys->attr, -- (char **)argv, environ) == 0) -- { -- while (waitpid (pid, NULL, 0) != pid); -- } - } - - /***************************************************************************** + --- ./modules/misc/inhibit/xscreensaver.c.ORIG 2010-04-13 02:22:27.000000000 +0200 + +++ ./modules/misc/inhibit/xscreensaver.c 2010-11-20 10:28:58.000000000 +0100 + @@ -39,7 +39,6 @@ + #include <sys/wait.h> + #include <fcntl.h> + #include <signal.h> + -#include <spawn.h> + + /***************************************************************************** + * Local prototypes + @@ -53,13 +52,8 @@ + struct vlc_inhibit_sys + { + vlc_timer_t timer; + - posix_spawn_file_actions_t actions; + - posix_spawnattr_t attr; + - int nullfd; + }; + + -extern char **environ; + - + /***************************************************************************** + * Module descriptor + *****************************************************************************/ + @@ -88,21 +82,6 @@ + } + p_ih->inhibit = Inhibit; + + - int fd = vlc_open ("/dev/null", O_WRONLY); + - posix_spawn_file_actions_init (&p_sys->actions); + - if (fd != -1) + - { + - posix_spawn_file_actions_adddup2 (&p_sys->actions, fd, 1); + - posix_spawn_file_actions_adddup2 (&p_sys->actions, fd, 2); + - posix_spawn_file_actions_addclose (&p_sys->actions, fd); + - } + - p_sys->nullfd = fd; + - + - sigset_t set; + - posix_spawnattr_init (&p_sys->attr); + - sigemptyset (&set); + - posix_spawnattr_setsigmask (&p_sys->attr, &set); + - + return VLC_SUCCESS; + } + + @@ -115,10 +94,6 @@ + vlc_inhibit_sys_t *p_sys = p_ih->p_sys; + + vlc_timer_destroy( p_sys->timer ); + - if (p_sys->nullfd != -1) + - close (p_sys->nullfd); + - posix_spawnattr_destroy (&p_sys->attr); + - posix_spawn_file_actions_destroy (&p_sys->actions); + free( p_sys ); + } + + @@ -131,15 +106,33 @@ + /***************************************************************************** + * Execute: Spawns a process using execv() + *****************************************************************************/ + -static void Execute (vlc_inhibit_t *p_ih, const char *const *argv) + +static void Execute( vlc_inhibit_t *p_ih, const char *const *ppsz_args ) + { + - vlc_inhibit_sys_t *p_sys = p_ih->p_sys; + - pid_t pid; + - + - if (posix_spawnp (&pid, argv[0], &p_sys->actions, &p_sys->attr, + - (char **)argv, environ) == 0) + + pid_t pid = fork(); + + switch( pid ) + { + - while (waitpid (pid, NULL, 0) != pid); + + case 0: /* we're the child */ + + { + + sigset_t set; + + sigemptyset (&set); + + pthread_sigmask (SIG_SETMASK, &set, NULL); + + + + /* We don't want output */ + + if( ( freopen( "/dev/null", "w", stdout ) != NULL ) + + && ( freopen( "/dev/null", "w", stderr ) != NULL ) ) + + execv( ppsz_args[0] , (char *const *)ppsz_args ); + + /* If the file we want to execute doesn't exist we exit() */ + + exit( EXIT_FAILURE ); + + } + + case -1: /* we're the error */ + + msg_Dbg( p_ih, "Couldn't fork() while launching %s", + + ppsz_args[0] ); + + break; + + default: /* we're the parent */ + + /* Wait for the child to exit. + + * We will not deadlock because we ran "/bin/sh &" */ + + while( waitpid( pid, NULL, 0 ) != pid); + + break; + } + } + |