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: v9.5.0~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb98de7087f502ead09ac77e84650890aef7193c;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 1a9969cf..3bbee5e1 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -366,6 +366,13 @@ ps_dostart(struct dhcpcd_ctx *ctx, 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->fork_fd != -1) { close(ctx->fork_fd); @@ -964,9 +971,6 @@ ps_recvpsmsg(struct dhcpcd_ctx *ctx, int fd, 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; }