]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Unload dev early if we are not the root process
authorRoy Marples <roy@marples.name>
Mon, 9 Jan 2023 16:35:37 +0000 (16:35 +0000)
committerRoy Marples <roy@marples.name>
Mon, 9 Jan 2023 16:37:25 +0000 (16:37 +0000)
No point listening to it and newer udev throws an error
trying to unload when chrooted so this fixes that.

src/privsep.c

index 1a9969cfc9b826380cb8b8e3e1445fc36fd96996..3bbee5e1b05664dbaada8c8cf723946e84b4aa43 100644 (file)
@@ -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;
        }