diff options
| author | Roy Marples <roy@marples.name> | 2020-06-16 11:58:16 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-06-16 11:58:16 +0000 |
| commit | 84a8cab4e03c42b445fbcb33c3c03dd93e8803cc (patch) | |
| tree | 146d8dbc81f0365edb5b42a3c3c24689e4b28dfd /src/privsep-root.c | |
| parent | 51954c915aa6914486fc386cbe1e9aece02d368c (diff) | |
| download | dhcpcd-84a8cab4e03c42b445fbcb33c3c03dd93e8803cc.tar.xz | |
privsep: Don't handle any signals meant for the main process
Just incase someone issues a killall -HUP dhcpcd
Diffstat (limited to 'src/privsep-root.c')
| -rw-r--r-- | src/privsep-root.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/privsep-root.c b/src/privsep-root.c index 46daeb07..98829aea 100644 --- a/src/privsep-root.c +++ b/src/privsep-root.c @@ -686,23 +686,24 @@ ps_root_signalcb(int sig, void *arg) { struct dhcpcd_ctx *ctx = arg; - /* Ignore SIGINT, respect PS_STOP command or SIGTERM. */ - if (sig == SIGINT) + /* Ignore dhcpcd signals, but reap children */ + switch (sig) { + case SIGINT: + case SIGALRM: + case SIGHUP: + case SIGUSR1: + case SIGUSR2: return; - - /* Reap children */ - if (sig == SIGCHLD) { + case SIGCHLD: while (waitpid(-1, NULL, WNOHANG) > 0) ; return; } - logerrx("process %d unexpectedly terminating on signal %d", - getpid(), sig); - if (ctx->ps_root_pid == getpid()) { - shutdown(ctx->ps_root_fd, SHUT_RDWR); - shutdown(ctx->ps_data_fd, SHUT_RDWR); - } + logerrx("%s: process %d unexpectedly terminating on signal %d", + __func__, getpid(), sig); + shutdown(ctx->ps_root_fd, SHUT_RDWR); + shutdown(ctx->ps_data_fd, SHUT_RDWR); eloop_exit(ctx->eloop, sig == SIGTERM ? EXIT_SUCCESS : EXIT_FAILURE); } |
