From d3c5af429c5ac1712c50645f85db1a31c6261d4d Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 8 Oct 2023 14:42:48 -0400 Subject: Don't treat SIGHUP specially If you want to restart the child, just restart kitd. --- kitd.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'kitd.c') diff --git a/kitd.c b/kitd.c index 4e5f518..f936e3f 100644 --- a/kitd.c +++ b/kitd.c @@ -174,23 +174,6 @@ int main(int argc, char *argv[]) { struct Line stderrBuffer = {0}; for (;;) { - if (signals[SIGHUP]) { - interval = restart; - if (child) killpg(child, SIGTERM); - signals[SIGHUP] = 0; - } - - if (signals[SIGINT] || signals[SIGTERM]) { - stop = true; - int sig = (signals[SIGINT] ? SIGINT : SIGTERM); - if (child) { - killpg(child, sig); - } else { - break; - } - signals[sig] = 0; - } - if (signals[SIGINFO]) { clock_gettime(CLOCK_MONOTONIC, &now); if (child) { @@ -203,9 +186,27 @@ int main(int argc, char *argv[]) { signals[SIGINFO] = 0; } - if (signals[SIGUSR1] || signals[SIGUSR2]) { - int sig = (signals[SIGUSR1] ? SIGUSR1 : SIGUSR2); - if (child) killpg(child, sig); + if (signals[SIGHUP]) { + if (child) killpg(child, SIGHUP); + signals[SIGHUP] = 0; + } + if (signals[SIGUSR1]) { + if (child) killpg(child, SIGUSR1); + signals[SIGUSR1] = 0; + } + if (signals[SIGUSR2]) { + if (child) killpg(child, SIGUSR2); + signals[SIGUSR2] = 0; + } + + if (signals[SIGINT] || signals[SIGTERM]) { + stop = true; + int sig = (signals[SIGINT] ? SIGINT : SIGTERM); + if (child) { + killpg(child, sig); + } else { + break; + } signals[sig] = 0; } -- cgit 1.4.1