From: Colin McInnes Date: Tue, 29 Oct 2024 15:30:59 +0000 (-0600) Subject: Don't set RLIMIT_FSIZE when dumping lease (#389) X-Git-Tag: v10.2.0~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=550c2bb5da56bd5a3c7f4073365a8a65ac6dc54c;p=thirdparty%2Fdhcpcd.git Don't set RLIMIT_FSIZE when dumping lease (#389) Check if output is a tty If dumping lease, check stdout otherwise check stderr. --------- Co-authored-by: Roy Marples --- diff --git a/src/privsep.c b/src/privsep.c index 45da237a..98e8f488 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -125,6 +125,8 @@ static int ps_dropprivs(struct dhcpcd_ctx *ctx) { struct passwd *pw = ctx->ps_user; + int fd_out = ctx->options & DHCPCD_DUMPLEASE ? + STDOUT_FILENO : STDERR_FILENO; if (ctx->options & DHCPCD_LAUNCHER) logdebugx("chrooting as %s to %s", pw->pw_name, pw->pw_dir); @@ -172,7 +174,7 @@ 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->options & DHC_NOCHKIO) == DHC_NOCHKIO || - (ctx->logfile == NULL && isatty(STDERR_FILENO) == 1)) + (ctx->logfile == NULL && isatty(fd_out) == 1)) { if (setrlimit(RLIMIT_FSIZE, &rzero) == -1) logerr("setrlimit RLIMIT_FSIZE");