summaryrefslogtreecommitdiffstats
path: root/src/privsep-root.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-06-16 20:58:17 +0100
committerRoy Marples <roy@marples.name>2020-06-16 20:58:17 +0100
commit9b3c9117fa48351e6b7e15176ace67163eccaecc (patch)
tree54594ae90d09bf32937786f68ea2c40c6fdaaae7 /src/privsep-root.c
parent7fbcfeda938e4f566b791c45dcc942e922abe63e (diff)
downloaddhcpcd-9b3c9117fa48351e6b7e15176ace67163eccaecc.tar.xz
privsep: Simplyfy signal handling
All privsep processes only need to act on SIGTERM. The privileged actioneer also needs to act on SIGCHLD.
Diffstat (limited to 'src/privsep-root.c')
-rw-r--r--src/privsep-root.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/privsep-root.c b/src/privsep-root.c
index 9129cc50..f1b40745 100644
--- a/src/privsep-root.c
+++ b/src/privsep-root.c
@@ -678,25 +678,18 @@ ps_root_signalcb(int sig, void *arg)
{
struct dhcpcd_ctx *ctx = arg;
- /* Ignore dhcpcd signals, but reap children */
- switch (sig) {
- case SIGINT:
- case SIGALRM:
- case SIGHUP:
- case SIGUSR1:
- case SIGUSR2:
- return;
- case SIGCHLD:
+ if (sig == SIGCHLD) {
while (waitpid(-1, NULL, WNOHANG) > 0)
;
return;
}
- logerrx("%s: process %d unexpectedly terminating on signal %d",
- __func__, getpid(), sig);
+ if (sig != SIGTERM)
+ return;
+
shutdown(ctx->ps_root_fd, SHUT_RDWR);
shutdown(ctx->ps_data_fd, SHUT_RDWR);
- eloop_exit(ctx->eloop, sig == SIGTERM ? EXIT_SUCCESS : EXIT_FAILURE);
+ eloop_exit(ctx->eloop, EXIT_SUCCESS);
}
int (*handle_interface)(void *, int, const char *);