From: Michael R Sweet Date: Fri, 20 Sep 2024 15:40:28 +0000 (-0400) Subject: Mirror fix for max-fds from 2.5. X-Git-Tag: v2.4.11~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96a330d5e594025280d76966f09862764a1e6b2c;p=thirdparty%2Fcups.git Mirror fix for max-fds from 2.5. --- diff --git a/scheduler/client.c b/scheduler/client.c index d47b84d066..233f9017d2 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -80,7 +80,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */ * Make sure we don't have a full set of clients already... */ - if (cupsArrayCount(Clients) == MaxClients) + if (MaxClients > 0 && cupsArrayCount(Clients) >= MaxClients) return; cupsdSetBusyState(1); diff --git a/scheduler/main.c b/scheduler/main.c index c91f47710e..a939cdae1f 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -523,13 +523,14 @@ main(int argc, /* I - Number of command-line args */ * to the number of TCP port number values (64k-1)... */ + limit.rlim_max = 0; getrlimit(RLIMIT_NOFILE, &limit); #if !defined(HAVE_POLL) && !defined(HAVE_EPOLL) && !defined(HAVE_KQUEUE) - if ((MaxFDs = limit.rlim_max) > FD_SETSIZE) + if ((MaxFDs = limit.rlim_max) > FD_SETSIZE || MaxFDs <= 0) MaxFDs = FD_SETSIZE; #else - if ((MaxFDs = limit.rlim_max) > 65535) + if ((MaxFDs = limit.rlim_max) > 65535 || MaxFDs <= 0) MaxFDs = 65535; #endif /* RLIM_INFINITY */