From: Roy Marples Date: Sat, 10 Oct 2020 16:54:03 +0000 (+0100) Subject: privsep: We need to ensure stderr is valid before testing if tty X-Git-Tag: v9.3.1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fb0b5dc43908f92498ff0298020c879f0681ea4;p=thirdparty%2Fdhcpcd.git privsep: We need to ensure stderr is valid before testing if tty --- diff --git a/src/privsep.c b/src/privsep.c index 0175c587..a3db98e0 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -167,7 +167,8 @@ ps_dropprivs(struct dhcpcd_ctx *ctx) * Obviously this won't work if we are using a logfile * or redirecting stderr to a file. */ if (ctx->logfile == NULL && - (ctx->options & DHCPCD_STARTED || isatty(STDERR_FILENO) == 1)) + (ctx->options & DHCPCD_STARTED || + (ctx->stderr_valid && isatty(STDERR_FILENO) == 1))) { if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) logerr("setrlimit RLIMIT_FSIZE");