Permalink
Browse files

fix child exit, reset signals

  • Loading branch information...
1 parent 615aed6 commit 66b84e382fad7350c45e300b0929f639df98cb9d @tj committed Nov 8, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/mon.c
View
@@ -81,13 +81,14 @@ alive(pid_t pid) {
}
/*
- * Kill everythanggg.
+ * Graceful exit, signal child.
*/
void
graceful_exit(int sig) {
log("shutting down");
- kill(pid, sig);
+ log("kill(%d, %d)", sig, pid);
+ kill(pid, SIGKILL);
exit(1);
}
@@ -211,6 +212,8 @@ exec: {
perror("fork()");
exit(1);
case 0:
+ signal(SIGTERM, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
log("sh -c \"%s\"", cmd);
execl("/bin/sh", "sh", "-c", cmd, 0);
perror("execl()");

0 comments on commit 66b84e3

Please sign in to comment.