summaryrefslogtreecommitdiffstats
path: root/src/privsep.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-09-06 02:41:08 +0100
committerRoy Marples <roy@marples.name>2020-09-06 02:41:08 +0100
commit71b878695ef0557a036fee35997e52cd1f3d2aea (patch)
treeb9ebe3c4510a00663e8b6993c39c3a35b7bafde1 /src/privsep.c
parente80f2a5aeaf2e249ca6b6a10090f64c69ea99719 (diff)
downloaddhcpcd-71b878695ef0557a036fee35997e52cd1f3d2aea.tar.xz
dhcpcd: Redirect stdout/stderr to the launcher stderr descriptor
This actually make life really simple! We no longer need to redirect stdout/stderr to /dev/null for privsep and any script output is now captured again - and it all goes to stderr as it should even if a script wants it to go to stdout. On the happy path, only the master process will actually log anything to stderr so we turn that off after we "fork". On the unhappy path, logging to stderr/stdout *may* fail because the launcher process *may* have exited. We *could* have the master process as an intermediary but that's just excess code to avoid errors which *should* not happen. Regardless, any errror should still hit syslog.
Diffstat (limited to 'src/privsep.c')
-rw-r--r--src/privsep.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/privsep.c b/src/privsep.c
index 2319ac57..bdef041f 100644
--- a/src/privsep.c
+++ b/src/privsep.c
@@ -163,7 +163,7 @@ 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 && isatty(loggeterrfd())) {
+ if (ctx->logfile == NULL) {
if (setrlimit(RLIMIT_FSIZE, &rzero) == -1)
logerr("setrlimit RLIMIT_FSIZE");
}