daemon: exit monitor process for SIG{HUP,TERM,USR1}
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 1 May 2012 20:38:43 +0000 (22:38 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 1 May 2012 20:38:43 +0000 (22:38 +0200)
It ensures that binding socket is closed in monitor process. It also
ensures that even if child process makes a failure during termination,
SIGSEGV or other, monitor process also terminates.

src/daemon.c

index 82d1c9e..5d7979d 100644 (file)
@@ -66,7 +66,10 @@ pid_t child_pid = 0;
 static void kill_child_handler(int num)
 {
     if (child_pid)
+    {
         kill(child_pid, num);
+        _exit(0);
+    }
 }
 
 static void keepalive(void (*work)(void *data), void *data)