summaryrefslogtreecommitdiffstats
path: root/src/privsep.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-10-10 17:54:03 +0100
committerRoy Marples <roy@marples.name>2020-10-10 17:54:03 +0100
commit3fb0b5dc43908f92498ff0298020c879f0681ea4 (patch)
treeb9205897205a233dcdbeb678fb2c384e12ac1f05 /src/privsep.c
parentef6ee8b83f7eb8ef99713dcd6b3108d6ff61a74a (diff)
downloaddhcpcd-3fb0b5dc43908f92498ff0298020c879f0681ea4.tar.xz
privsep: We need to ensure stderr is valid before testing if tty
Diffstat (limited to 'src/privsep.c')
-rw-r--r--src/privsep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/privsep.c b/src/privsep.c
index 0175c587..a3db98e0 100644
--- a/src/privsep.c
+++ b/src/privsep.c
@@ -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");