diff options
| author | Roy Marples <roy@marples.name> | 2020-07-01 11:45:06 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-07-01 11:45:06 +0100 |
| commit | 2b724a4592025c947edab5c609a87f54a66991ac (patch) | |
| tree | baa792c64a49cfe2056bdc6ff814007519592e73 /src/privsep.c | |
| parent | 070bd2aef3b4e8f9ad3a9b8de6242846cf3cf5be (diff) | |
| download | dhcpcd-2b724a4592025c947edab5c609a87f54a66991ac.tar.xz | |
privsep: Don't limit file writes if logging to a file
stderr could be redirected.
While here, there is no longer a need to redirect stderr or stdout
as they already have been in dhcpcd.
Diffstat (limited to 'src/privsep.c')
| -rw-r--r-- | src/privsep.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/privsep.c b/src/privsep.c index 34e00a40..65260f2c 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -160,8 +160,9 @@ ps_dropprivs(struct dhcpcd_ctx *ctx) } /* Prohibit writing to files. - * Obviously this won't work if we are using a logfile. */ - if (ctx->logfile == NULL) { + * Obviously this won't work if we are using a logfile + * or redirecting stderr to a file. */ + if (ctx->logfile == NULL && isatty(loggeterrfd())) { if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) logerr("setrlimit RLIMIT_FSIZE"); } @@ -365,14 +366,6 @@ ps_dostart(struct dhcpcd_ctx *ctx, if (callback(recv_ctx) == -1) goto errexit; - if (!(ctx->options & DHCPCD_DEBUG) && - (!(ctx->options & DHCPCD_TEST) || loggetopts() & LOGERR_QUIET)) - { - if (freopen(_PATH_DEVNULL, "w", stdout) == NULL || - freopen(_PATH_DEVNULL, "w", stderr) == NULL) - logerr("%s: freopen", __func__); - } - if (flags & PSF_DROPPRIVS) ps_dropprivs(ctx); |
