From 9311ab76a523de516b6bc98afda9e4b790225514 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 4 Nov 2005 15:34:09 +0000 Subject: * 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. --- src/libmain/shared.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index bc7b2dd51fef..709b6116a67e 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; -- cgit 1.4.1