]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Fix stderr redirection again
authorRoy Marples <roy@marples.name>
Sat, 10 Oct 2020 14:07:38 +0000 (15:07 +0100)
committerRoy Marples <roy@marples.name>
Sat, 10 Oct 2020 14:07:38 +0000 (15:07 +0100)
src/privsep.c

index aa87cd0cdff4a5ef6537b7933cebe824d4d42036..0175c5874136125614fa8131f76d63974b7da1ba 100644 (file)
@@ -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");
        }