From: Dan Harkless Date: Thu, 13 May 1999 01:25:52 +0000 (+0000) Subject: Fixed a signal-handling bug that could cause whatnow to sometimes exit X-Git-Tag: nmh-1_0~187 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=e6082c44cba0749864df4db1e0ce43fb9ce2a68a Fixed a signal-handling bug that could cause whatnow to sometimes exit without prompting the user. Based on a patch by Richard Geiger . --- diff --git a/sbr/pidwait.c b/sbr/pidwait.c index 4bd02e3..0bbe588 100644 --- a/sbr/pidwait.c +++ b/sbr/pidwait.c @@ -18,6 +18,7 @@ pidwait (pid_t id, int sigsok) { pid_t pid; sigset_t set, oset; + SIGNAL_HANDLER istat, qstat; #ifdef WAITINT int status; @@ -26,11 +27,9 @@ pidwait (pid_t id, int sigsok) #endif if (sigsok == -1) { - /* block a couple of signals */ - sigemptyset (&set); - sigaddset (&set, SIGINT); - sigaddset (&set, SIGQUIT); - SIGPROCMASK (SIG_BLOCK, &set, &oset); + /* ignore a couple of signals */ + istat = SIGNAL (SIGINT, SIG_IGN); + qstat = SIGNAL (SIGQUIT, SIG_IGN); } #ifdef HAVE_WAITPID @@ -41,8 +40,9 @@ pidwait (pid_t id, int sigsok) #endif if (sigsok == -1) { - /* reset the signal mask */ - SIGPROCMASK (SIG_SETMASK, &oset, &set); + /* reset the signal handlers */ + SIGNAL (SIGINT, istat); + SIGNAL (SIGQUIT, qstat); } #ifdef WAITINT