X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Fsubprocs.c;h=009bb6dc529905286b79573e90a469c959d81194;hb=488f2fa8fbdbc77e91a70da2962d73af49e6cace;hp=0bbe4a87609c836239b693642957276d33f64a89;hpb=07faf451b99879183ed7e909e43a0e065be1ee7f;p=xscreensaver diff --git a/driver/subprocs.c b/driver/subprocs.c index 0bbe4a87..009bb6dc 100644 --- a/driver/subprocs.c +++ b/driver/subprocs.c @@ -1,5 +1,5 @@ /* subprocs.c --- choosing, spawning, and killing screenhacks. - * xscreensaver, Copyright (c) 1991-2006 Jamie Zawinski + * xscreensaver, Copyright (c) 1991-2007 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -93,7 +93,7 @@ no_malloc_number_to_string (long num) num = -num; } - while ((num > 0) && (num_digits < sizeof(string - 1))) + while ((num > 0) && (num_digits < sizeof(string) - 1)) { int digit; digit = (int) num % 10; @@ -360,12 +360,20 @@ static int block_sigchld_handler = 0; block_sigchld (void) { #ifdef HAVE_SIGACTION + struct sigaction sa; sigset_t child_set; + + memset (&sa, 0, sizeof (sa)); + sa.sa_handler = SIG_IGN; + sigaction (SIGPIPE, &sa, NULL); + sigemptyset (&child_set); sigaddset (&child_set, SIGCHLD); - sigaddset (&child_set, SIGPIPE); sigprocmask (SIG_BLOCK, &child_set, 0); -#endif /* HAVE_SIGACTION */ + +#else /* !HAVE_SIGACTION */ + signal (SIGPIPE, SIG_IGN); +#endif /* !HAVE_SIGACTION */ block_sigchld_handler++; @@ -380,12 +388,20 @@ void unblock_sigchld (void) { #ifdef HAVE_SIGACTION + struct sigaction sa; sigset_t child_set; + + memset(&sa, 0, sizeof (sa)); + sa.sa_handler = SIG_DFL; + sigaction(SIGPIPE, &sa, NULL); + sigemptyset(&child_set); sigaddset(&child_set, SIGCHLD); - sigaddset(&child_set, SIGPIPE); sigprocmask(SIG_UNBLOCK, &child_set, 0); -#endif /* HAVE_SIGACTION */ + +#else /* !HAVE_SIGACTION */ + signal(SIGPIPE, SIG_DFL); +#endif /* !HAVE_SIGACTION */ block_sigchld_handler--; }