* 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.
This commit is contained in:
Eelco Dolstra 2005-11-04 15:34:09 +00:00
parent 5bf939885a
commit 9311ab76a5
1 changed files with 4 additions and 0 deletions

View File

@ -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;