From fbdb63665bef739a56e080670c78bda57b24af78 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 3 Sep 2002 14:07:03 +0000 Subject: [PATCH] [project @ 2002-09-03 14:07:03 by simonmar] stg_sig_install: restore the old signal mask at the end, rather than unconditionally unblocking the signal we just installed the handler for. --- ghc/rts/Signals.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghc/rts/Signals.c b/ghc/rts/Signals.c index 40535af..0685a2b 100644 --- a/ghc/rts/Signals.c +++ b/ghc/rts/Signals.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Signals.c,v 1.26 2002/07/17 09:21:51 simonmar Exp $ + * $Id: Signals.c,v 1.27 2002/09/03 14:07:03 simonmar Exp $ * * (c) The GHC Team, 1998-1999 * @@ -199,14 +199,14 @@ awaitUserSignals(void) StgInt stg_sig_install(StgInt sig, StgInt spi, StgStablePtr handler, void *mask) { - sigset_t signals; + sigset_t signals, osignals; struct sigaction action; StgInt previous_spi; // Block the signal until we figure out what to do // Count on this to fail if the signal number is invalid if (sig < 0 || sigemptyset(&signals) || - sigaddset(&signals, sig) || sigprocmask(SIG_BLOCK, &signals, NULL)) { + sigaddset(&signals, sig) || sigprocmask(SIG_BLOCK, &signals, &osignals)) { return STG_SIG_ERR; } @@ -246,7 +246,7 @@ stg_sig_install(StgInt sig, StgInt spi, StgStablePtr handler, void *mask) action.sa_flags = sig == SIGCHLD && nocldstop ? SA_NOCLDSTOP : 0; if (sigaction(sig, &action, NULL) || - sigprocmask(SIG_UNBLOCK, &signals, NULL)) + sigprocmask(SIG_SETMASK, &osignals, NULL)) { // need to return an error code, so avoid a stable pointer leak // by freeing the previous handler if there was one. -- 1.7.10.4