From 3ffb1dd5ee2a4962dd1384e00566996f791fcc78 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 27 Jan 2021 14:11:52 +0000 Subject: [PATCH] privsep: move setting signals to after clearing eloop --- src/privsep.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/privsep.c b/src/privsep.c index d5c7c562..23ed9e7e 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -369,7 +369,15 @@ ps_dostart(struct dhcpcd_ctx *ctx, ctx->fork_fd = -1; } pidfile_clean(); + eloop_clear(ctx->eloop); + eloop_signal_set_cb(ctx->eloop, + dhcpcd_signals, dhcpcd_signals_len, signal_cb, ctx); + /* ctx->sigset aready has the initial sigmask set in main() */ + if (eloop_signal_mask(ctx->eloop, NULL) == -1) { + logerr("%s: eloop_signal_mask", __func__); + goto errexit; + } /* We are not root */ if (priv_fd != &ctx->ps_root_fd) { @@ -393,15 +401,6 @@ ps_dostart(struct dhcpcd_ctx *ctx, ctx->ps_inet_fd = -1; } - eloop_signal_set_cb(ctx->eloop, - dhcpcd_signals, dhcpcd_signals_len, signal_cb, ctx); - - /* ctx->sigset aready has the initial sigmask set in main() */ - if (eloop_signal_mask(ctx->eloop, NULL) == -1) { - logerr("%s: eloop_signal_mask", __func__); - goto errexit; - } - if (eloop_event_add(ctx->eloop, *priv_fd, recv_msg, recv_ctx) == -1) { logerr("%s: eloop_event_add", __func__);