diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-11-04 15:34:09 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-11-04 15:34:09 +0000 |
commit | 9311ab76a523de516b6bc98afda9e4b790225514 (patch) | |
tree | 1ff31ad158d89a179d1f3b9062b842e12ce029f6 | |
parent | 5bf939885a8bfca9b66a2440bf52330c5fde6477 (diff) |
* Install signal handlers for SIGTERM and SIGHUP. This ensures that
Nix is properly shut down when it receives those signals. In
particular this ensures that killing the garbage collector doesn't
cause a subsequent database recovery.
-rw-r--r-- | src/libmain/shared.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index bc7b2dd51..709b6116a 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -120,6 +120,10 @@ static void initAndRun(int argc, char * * argv) act.sa_flags = 0; if (sigaction(SIGINT, &act, &oact)) throw SysError("installing handler for SIGINT"); + if (sigaction(SIGTERM, &act, &oact)) + throw SysError("installing handler for SIGTERM"); + if (sigaction(SIGHUP, &act, &oact)) + throw SysError("installing handler for SIGHUP"); /* Ignore SIGPIPE. */ act.sa_handler = SIG_IGN; |