From: Roy Marples Date: Fri, 27 Mar 2020 16:04:35 +0000 (+0000) Subject: privsep: Don't close output streams if debugging or testing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a02aa585463b3967bccba8659139139638957d3a;p=thirdparty%2Fdhcpcd.git privsep: Don't close output streams if debugging or testing --- diff --git a/src/privsep.c b/src/privsep.c index a188d7d7..99a507e7 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -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);