Download raw body.
gotd: Don't use WNOHANG when waiting for child processes
Fixes this:
2023-03-03T13:51:15.155Z silicon gotd[7715]: child PID 0 terminated; signal 12
2023-03-03T13:51:15.186Z silicon last message repeated 419 times
diff 6221bdf771a3f2638d2aca0a58162261424f2ca6 2a511b1a88651c9b58f9390624dc29312b627b5e
commit - 6221bdf771a3f2638d2aca0a58162261424f2ca6
commit + 2a511b1a88651c9b58f9390624dc29312b627b5e
blob - 86f2b6013f0c53e31f8adbc89cd954b062c2ee0b
blob + c74da7c7b48e76509e16e1ed0428b5e9b6d53251
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -276,15 +276,15 @@ wait_for_child(pid_t child_pid)
(long)child_pid);
do {
- pid = waitpid(child_pid, &status, WNOHANG);
+ pid = waitpid(child_pid, &status, 0);
if (pid == -1) {
- if (errno != EINTR && errno != ECHILD)
- fatal("wait");
+ if (errno != EINTR)
+ fatal("waitpid");
} else if (WIFSIGNALED(status)) {
log_warnx("child PID %ld terminated; signal %d",
(long)pid, WTERMSIG(status));
}
- } while (pid != -1 || (pid == -1 && errno == EINTR));
+ } while (pid == -1 && errno == EINTR);
}
static void
gotd: Don't use WNOHANG when waiting for child processes