about summary refs log tree commit diff
path: root/kitd.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2023-10-08 14:42:48 -0400
committerJune McEnroe <june@causal.agency>2023-10-08 14:42:48 -0400
commitd3c5af429c5ac1712c50645f85db1a31c6261d4d (patch)
treead883b9ba99df8e54b49d084376eb704356e1207 /kitd.c
parentDon't put the child PID in proctitle (diff)
downloadkitd-d3c5af429c5ac1712c50645f85db1a31c6261d4d.tar.gz
kitd-d3c5af429c5ac1712c50645f85db1a31c6261d4d.zip
Don't treat SIGHUP specially
If you want to restart the child, just restart kitd.
Diffstat (limited to 'kitd.c')
-rw-r--r--kitd.c41
1 files changed, 21 insertions, 20 deletions
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;
 		}