changeset 5514:cf82a4ba8f27 draft

privsep: We need to ensure stderr is valid before testing if tty
author Roy Marples <roy@marples.name>
date Sat, 10 Oct 2020 17:54:03 +0100
parents 93df3880bcaa
children 652b46c01097
files src/privsep.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/privsep.c	Sat Oct 10 15:07:38 2020 +0100
+++ b/src/privsep.c	Sat Oct 10 17:54:03 2020 +0100
@@ -167,7 +167,8 @@
 	 * 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");