]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Don't try to unlink the pidfile in test mode
authorRoy Marples <roy@marples.name>
Tue, 7 Feb 2023 16:39:00 +0000 (16:39 +0000)
committerRoy Marples <roy@marples.name>
Tue, 7 Feb 2023 16:39:00 +0000 (16:39 +0000)
src/privsep-root.c

index db445ec4362b7672e207eda666c2ad8f2230a246..c635182129f2e0896d9b75a1f24510494f563b8c 100644 (file)
@@ -945,7 +945,9 @@ ps_root_stop(struct dhcpcd_ctx *ctx)
                return 0;
 
        /* If we are the root process then remove the pidfile */
-       if (ctx->options & DHCPCD_PRIVSEPROOT) {
+       if (ctx->options & DHCPCD_PRIVSEPROOT &&
+           !(ctx->options & DHCPCD_TEST))
+       {
                if (unlink(ctx->pidfile) == -1)
                        logerr("%s: unlink: %s", __func__, ctx->pidfile);
        }