From: simonmar Date: Tue, 3 Sep 2002 14:07:03 +0000 (+0000) Subject: [project @ 2002-09-03 14:07:03 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~1729 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=fbdb63665bef739a56e080670c78bda57b24af78;p=ghc-hetmet.git [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. --- 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.