privsep: move setting signals to after clearing eloop

This commit is contained in:
Roy Marples 2021-01-27 14:11:52 +00:00
parent 534eb959e8
commit 3ffb1dd5ee

View File

@ -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__);