aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorRaven <citrons@mondecitronne.com>2026-11-27 04:01:43 -0600
committerRaven <citrons@mondecitronne.com>2026-11-27 04:01:43 -0600
commitc0a477105e31c54b00a06e0ec66eed243d6c2150 (patch)
tree8ad61941683e09f9f78ae640898645e8a430f3e5 /src/main.c
parentd3b5ea00a47f1eda20d86129a4569ed75bbf7094 (diff)
handle WIFSIGNALEDHEADmaster
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 9e3e551..fa17bda 100644
--- a/src/main.c
+++ b/src/main.c
@@ -177,12 +177,15 @@ static void handle_child() {
if (w == -1) {
return;
}
- if (w == pid && WIFEXITED(status)) {
+ if (w != pid) return;
+ if (WIFEXITED(status)) {
is_child = false;
detach();
- fprintf(
- stderr, "child exited with status %d\n", WEXITSTATUS(status)
- );
+ fprintf(stderr, "child exited with status %d\n", WEXITSTATUS(status));
+ } else if (WIFSIGNALED(status)) {
+ is_child = false;
+ detach();
+ fprintf(stderr, "child terminated with signal %d\n", WTERMSIG(status));
}
}