From ab4fa4869bf147f316b418e6c1a24807d82ed5f6 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 1 May 2012 22:38:43 +0200 Subject: [PATCH] daemon: exit monitor process for SIG{HUP,TERM,USR1} 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/daemon.c b/src/daemon.c index 82d1c9e..5d7979d 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -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) -- 1.7.10.4