changeset 5513:93df3880bcaa draft

privsep: Fix stderr redirection again
author Roy Marples <roy@marples.name>
date Sat, 10 Oct 2020 15:07:38 +0100
parents adb3ad34082f
children cf82a4ba8f27
files src/privsep.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/privsep.c	Sat Oct 10 15:06:59 2020 +0100
+++ b/src/privsep.c	Sat Oct 10 15:07:38 2020 +0100
@@ -166,7 +166,9 @@
 	/* Prohibit writing to files.
 	 * Obviously this won't work if we are using a logfile
 	 * or redirecting stderr to a file. */
-	if (ctx->logfile == NULL) {
+	if (ctx->logfile == NULL &&
+	    (ctx->options & DHCPCD_STARTED || isatty(STDERR_FILENO) == 1))
+	{
 		if (setrlimit(RLIMIT_FSIZE, &rzero) == -1)
 			logerr("setrlimit RLIMIT_FSIZE");
 	}