]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: Don't add 1 to max fd open when limiting resources
authorRoy Marples <roy@marples.name>
Thu, 28 Jan 2021 12:13:45 +0000 (12:13 +0000)
committerRoy Marples <roy@marples.name>
Thu, 28 Jan 2021 12:13:45 +0000 (12:13 +0000)
It shoud no longer be needed for OpenBSD, Linux and Solaris.

src/privsep.c

index 6dde4a1bd451d454ca709782efc1089ff26f3022..fb77bd27fa884f20b96056484165c38214ca12bf 100644 (file)
@@ -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