/* subprocs.c --- choosing, spawning, and killing screenhacks.
- * xscreensaver, Copyright (c) 1991-2006 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1991-2008 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
num = -num;
}
- while ((num > 0) && (num_digits < sizeof(string - 1)))
+ while ((num > 0) && (num_digits < sizeof(string) - 1))
{
int digit;
digit = (int) num % 10;
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++;
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--;
}
execvp (av[0], av); /* shouldn't return. */
- if (errno != ENOENT || si->prefs.verbose_p)
+ if (errno != ENOENT /* || si->prefs.verbose_p */ )
{
- /* Ignore "no such file or directory" errors, unless verbose.
+ /* Ignore "no such file or directory" errors.
Issue all other exec errors, though. */
sprintf (buf, "%s: running %s", blurb(), av[0]);
perror (buf);