All privsep processes only need to act on SIGTERM.
The privileged actioneer also needs to act on SIGCHLD.
{
struct dhcpcd_ctx *ctx = arg;
- /* Ignore dhcpcd signals */
- switch (sig) {
- case SIGINT:
- case SIGALRM:
- case SIGHUP:
- case SIGUSR1:
- case SIGUSR2:
+ if (sig != SIGTERM)
return;
- }
- eloop_exit(ctx->eloop, sig == SIGTERM ? EXIT_SUCCESS : EXIT_FAILURE);
+ eloop_exit(ctx->eloop, EXIT_SUCCESS);
}
ssize_t
{
struct dhcpcd_ctx *ctx = arg;
- /* Ignore dhcpcd signals */
- switch (sig) {
- case SIGINT:
- case SIGALRM:
- case SIGHUP:
- case SIGUSR1:
- case SIGUSR2:
+ if (sig != SIGTERM)
return;
- }
shutdown(ctx->ps_control_fd, SHUT_RDWR);
- eloop_exit(ctx->eloop, sig == SIGTERM ? EXIT_SUCCESS : EXIT_FAILURE);
+ eloop_exit(ctx->eloop, EXIT_SUCCESS);
}
ssize_t
{
struct dhcpcd_ctx *ctx = arg;
- /* Ignore dhcpcd signals */
- switch (sig) {
- case SIGINT:
- case SIGALRM:
- case SIGHUP:
- case SIGUSR1:
- case SIGUSR2:
+ if (sig != SIGTERM)
return;
- }
shutdown(ctx->ps_inet_fd, SHUT_RDWR);
- eloop_exit(ctx->eloop, sig == SIGTERM ? EXIT_SUCCESS : EXIT_FAILURE);
+ eloop_exit(ctx->eloop, EXIT_SUCCESS);
}
ssize_t
{
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 *);