X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=driver%2Fsubprocs.c;h=ecbaeb24a31080ca669cdd698581c6ad0aa7d860;hb=88cfe534a698a0562e81345957a50714af1453bc;hp=2a8f163ec6522da4bde3bb3e5e72d25ae5c611f0;hpb=6f5482d73adb0165c0130bb47d852644ab0c4869;p=xscreensaver diff --git a/driver/subprocs.c b/driver/subprocs.c index 2a8f163e..ecbaeb24 100644 --- a/driver/subprocs.c +++ b/driver/subprocs.c @@ -1,5 +1,5 @@ /* subprocs.c --- choosing, spawning, and killing screenhacks. - * xscreensaver, Copyright (c) 1991-2012 Jamie Zawinski + * xscreensaver, Copyright (c) 1991-2015 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 @@ -387,6 +387,11 @@ block_sigchld (void) void unblock_sigchld (void) { + if (block_sigchld_handler <= 0) + abort(); + + if (block_sigchld_handler <= 1) /* only unblock if count going to 0 */ + { #ifdef HAVE_SIGACTION struct sigaction sa; sigset_t child_set; @@ -402,6 +407,7 @@ unblock_sigchld (void) #else /* !HAVE_SIGACTION */ signal(SIGPIPE, SIG_DFL); #endif /* !HAVE_SIGACTION */ + } block_sigchld_handler--; } @@ -415,7 +421,7 @@ kill_job (saver_info *si, pid_t pid, int signal) clean_job_list(); - if (block_sigchld_handler) + if (in_signal_handler_p) /* This function should not be called from the signal handler. */ abort(); @@ -1101,7 +1107,9 @@ hack_environment (saver_info *si) if (def_path && *def_path) { const char *opath = getenv("PATH"); - char *npath = (char *) malloc(strlen(def_path) + strlen(opath) + 20); + char *npath; + if (! opath) opath = "/bin:/usr/bin"; /* WTF */ + npath = (char *) malloc(strlen(def_path) + strlen(opath) + 20); strcpy (npath, "PATH="); strcat (npath, def_path); strcat (npath, ":");