]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Don't close output streams if debugging or testing
authorRoy Marples <roy@marples.name>
Fri, 27 Mar 2020 16:04:35 +0000 (16:04 +0000)
committerRoy Marples <roy@marples.name>
Fri, 27 Mar 2020 16:04:35 +0000 (16:04 +0000)
src/privsep.c

index a188d7d7899826e8d5b57075992fbd61060a41fe..99a507e77b39fb363d54981b5516e1788c1b9a4a 100644 (file)
@@ -233,8 +233,10 @@ ps_dostart(struct dhcpcd_ctx *ctx,
        if (callback(recv_ctx) == -1)
                goto errexit;
 
-       freopen(_PATH_DEVNULL, "w", stdout);
-       freopen(_PATH_DEVNULL, "w", stderr);
+       if (!(ctx->options & (DHCPCD_TEST | DHCPCD_DEBUG))) {
+               freopen(_PATH_DEVNULL, "w", stdout);
+               freopen(_PATH_DEVNULL, "w", stderr);
+       }
 
        if (flags & PSF_DROPPRIVS)
                ps_dropprivs(ctx);