summaryrefslogtreecommitdiffstats
path: root/src/privsep-root.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-06-04 12:15:20 +0100
committerRoy Marples <roy@marples.name>2020-06-04 12:15:20 +0100
commit8d006faa0a2d70427e98794eaff310e85c482ed2 (patch)
tree06de261a3ac3a163c1b218f4b60f3231058edd4f /src/privsep-root.c
parentbf42cf87e310345759e463400cf365bc7ba1d458 (diff)
downloaddhcpcd-8d006faa0a2d70427e98794eaff310e85c482ed2.tar.xz
privsep: Don't wait for the process to finish when stopping it
Instead, wait on receipt of SIGCHLD so we're not blocked.
Diffstat (limited to 'src/privsep-root.c')
-rw-r--r--src/privsep-root.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/privsep-root.c b/src/privsep-root.c
index 5c91b4a8..2a45abb9 100644
--- a/src/privsep-root.c
+++ b/src/privsep-root.c
@@ -686,6 +686,13 @@ ps_root_signalcb(int sig, void *arg)
if (sig == SIGINT)
return;
+ /* Reap children */
+ if (sig == SIGCHLD) {
+ while (waitpid(-1, NULL, WNOHANG) > 0)
+ ;
+ return;
+ }
+
logerrx("process %d unexpectedly terminating on signal %d",
getpid(), sig);
if (ctx->ps_root_pid == getpid()) {