summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2021-01-28 12:13:45 +0000
committerRoy Marples <roy@marples.name>2021-01-28 12:13:45 +0000
commit62cb1ffc5096f64b7e06dab1202fdead4e85deeb (patch)
tree4537403aaac7cca5117a529b3ff95227aa130ece
parent44bbb1a68bcc2ee47eaa30aea2adefabe55b6807 (diff)
downloaddhcpcd-62cb1ffc5096f64b7e06dab1202fdead4e85deeb.tar.xz
privsep: Don't add 1 to max fd open when limiting resources
It shoud no longer be needed for OpenBSD, Linux and Solaris.
-rw-r--r--src/privsep.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/privsep.c b/src/privsep.c
index 6dde4a1b..fb77bd27 100644
--- a/src/privsep.c
+++ b/src/privsep.c
@@ -148,13 +148,12 @@ ps_dropprivs(struct dhcpcd_ctx *ctx)
*/
unsigned long maxfd;
maxfd = (unsigned long)eloop_event_count(ctx->eloop);
- if (IN_PRIVSEP_SE(ctx))
- maxfd++; /* XXX why? */
struct rlimit rmaxfd = {
.rlim_cur = maxfd,
.rlim_max = maxfd
};
+
if (setrlimit(RLIMIT_NOFILE, &rmaxfd) == -1)
logerr("setrlimit RLIMIT_NOFILE");
#else