From: Roy Marples Date: Sat, 10 Oct 2020 14:07:38 +0000 (+0100) Subject: privsep: Fix stderr redirection again X-Git-Tag: v9.3.1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef6ee8b83f7eb8ef99713dcd6b3108d6ff61a74a;p=thirdparty%2Fdhcpcd.git privsep: Fix stderr redirection again --- diff --git a/src/privsep.c b/src/privsep.c index aa87cd0c..0175c587 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -166,7 +166,9 @@ ps_dropprivs(struct dhcpcd_ctx *ctx) /* 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"); }