diff options
| author | Roy Marples <roy@marples.name> | 2020-06-04 12:15:20 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-06-04 12:15:20 +0100 |
| commit | 8d006faa0a2d70427e98794eaff310e85c482ed2 (patch) | |
| tree | 06de261a3ac3a163c1b218f4b60f3231058edd4f /src/privsep-root.c | |
| parent | bf42cf87e310345759e463400cf365bc7ba1d458 (diff) | |
| download | dhcpcd-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.c | 7 |
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()) { |
