summaryrefslogtreecommitdiffstats
path: root/src/privsep.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-10-10 15:07:38 +0100
committerRoy Marples <roy@marples.name>2020-10-10 15:07:38 +0100
commitef6ee8b83f7eb8ef99713dcd6b3108d6ff61a74a (patch)
tree25c2b2c715a433b05babbd40f3011d6565aea946 /src/privsep.c
parent9d0603cb46a40940630eed7b8df90e37748b7177 (diff)
downloaddhcpcd-ef6ee8b83f7eb8ef99713dcd6b3108d6ff61a74a.tar.xz
privsep: Fix stderr redirection again
Diffstat (limited to 'src/privsep.c')
-rw-r--r--src/privsep.c4
1 files changed, 3 insertions, 1 deletions
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");
}