diff options
Diffstat (limited to 'src/libmain')
-rw-r--r-- | src/libmain/shared.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 0f7a89814b6d..d9cf9a86262a 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -143,23 +143,29 @@ static void initAndRun(int argc, char * * argv) maxSilentTime = queryIntSetting("build-max-silent-time", 0); /* Catch SIGINT. */ - struct sigaction act, oact; + struct sigaction act; act.sa_handler = sigintHandler; sigfillset(&act.sa_mask); act.sa_flags = 0; - if (sigaction(SIGINT, &act, &oact)) + if (sigaction(SIGINT, &act, 0)) throw SysError("installing handler for SIGINT"); - if (sigaction(SIGTERM, &act, &oact)) + if (sigaction(SIGTERM, &act, 0)) throw SysError("installing handler for SIGTERM"); - if (sigaction(SIGHUP, &act, &oact)) + if (sigaction(SIGHUP, &act, 0)) throw SysError("installing handler for SIGHUP"); /* Ignore SIGPIPE. */ act.sa_handler = SIG_IGN; act.sa_flags = 0; - if (sigaction(SIGPIPE, &act, &oact)) + if (sigaction(SIGPIPE, &act, 0)) throw SysError("ignoring SIGPIPE"); + /* Reset SIGCHLD to its default. */ + act.sa_handler = SIG_DFL; + act.sa_flags = 0; + if (sigaction(SIGCHLD, &act, 0)) + throw SysError("resetting SIGCHLD"); + /* There is no privacy in the Nix system ;-) At least not for now. In particular, store objects should be readable by everybody. This prevents nasty surprises when using a shared |