]> 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:35:37 +0000 (16:35 +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 15377d4ddbdaf70510212d08d92d46f4f29ba4e7..765756d7668801ec326c794d44db5a67847f9511 100644 (file)
@@ -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;
        }