]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: We need to ensure stderr is valid before testing if tty
authorRoy Marples <roy@marples.name>
Sat, 10 Oct 2020 16:54:03 +0000 (17:54 +0100)
committerRoy Marples <roy@marples.name>
Sat, 10 Oct 2020 16:54:03 +0000 (17:54 +0100)
src/privsep.c

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