From 1060810510fcc403a25b553dbab3fd7dd5a64bef Mon Sep 17 00:00:00 2001 From: Dave West Date: Tue, 15 Jan 2008 16:54:31 +0000 Subject: [PATCH] Alter the webcit shutdown a bit more. Sending the watcher process a TERM kill the child and exits the watcher without shutdown. Sending the watcher a HUP shuts down cleanly. Dothebart said this was the prefered way to do it. --- webcit/webserver.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webcit/webserver.c b/webcit/webserver.c index 4993a6d0e..4d6472792 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -466,7 +466,8 @@ pid_t current_child; void graceful_shutdown_watcher(int signum) { lprintf (1, "bye; shutting down watcher."); kill(current_child, signum); -// exit(0); + if (signum != SIGHUP) + exit(0); } /** @@ -541,14 +542,14 @@ void start_daemon(char *pid_file) exit(errno); } - else if (current_child == 0) { - signal(SIGTERM, graceful_shutdown); + else if (current_child == 0) { // child process +// signal(SIGTERM, graceful_shutdown); signal(SIGHUP, graceful_shutdown); return; /* continue starting webcit. */ } - else { + else { // watcher process // signal(SIGTERM, SIG_IGN); // signal(SIGHUP, SIG_IGN); if (pid_file) { -- 2.39.2