From: Roy Marples Date: Mon, 9 Jan 2023 16:35:37 +0000 (+0000) Subject: privsep: Unload dev early if we are not the root process X-Git-Tag: v10.0.0~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c97eb896bbb9a2b285efce2fa15aa9d2a9492d1;p=thirdparty%2Fdhcpcd.git privsep: Unload dev early if we are not the root process No point listening to it and newer udev throws an error trying to unload when chrooted so this fixes that. --- diff --git a/src/privsep.c b/src/privsep.c index 15377d4d..765756d7 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -412,6 +412,13 @@ ps_startprocess(struct ps_process *psp, return pid; } + +#ifdef PLUGIN_DEV + /* If we are not the root process, stop listening to devices. */ + if (ctx->ps_root != psp) + dev_stop(ctx); +#endif + ctx->options |= DHCPCD_FORKED; if (ctx->ps_log_fd != -1) logsetfd(ctx->ps_log_fd); @@ -1142,9 +1149,6 @@ ps_recvpsmsg(struct dhcpcd_ctx *ctx, int fd, unsigned short events, logdebugx("process %d stopping", getpid()); #endif ps_free(ctx); -#ifdef PLUGIN_DEV - dev_stop(ctx); -#endif eloop_exit(ctx->eloop, len != -1 ? EXIT_SUCCESS : EXIT_FAILURE); return len; }