diff --git a/src/privsep.c b/src/privsep.c index f35502e0..5dbbd9cf 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -159,10 +159,13 @@ ps_dropprivs(struct dhcpcd_ctx *ctx) struct rlimit rzero = { .rlim_cur = 0, .rlim_max = 0 }; #ifndef __sun /* RLIMIT_NOFILE and ppoll don't mix */ + struct rlimit rnofile = { .rlim_cur = STDERR_FILENO + 1, + .rlim_max = STDERR_FILENO + 1 }; + /* Prohibit new files, sockets, etc * The control proxy *does* need to create new fd's via accept(2). */ if (ctx->ps_ctl == NULL || ctx->ps_ctl->psp_pid != getpid()) { - if (setrlimit(RLIMIT_NOFILE, &rzero) == -1) + if (setrlimit(RLIMIT_NOFILE, &rnofile) == -1) logerr("setrlimit RLIMIT_NOFILE"); } #endif