]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror fix for max-fds from 2.5.
authorMichael R Sweet <msweet@msweet.org>
Fri, 20 Sep 2024 15:40:28 +0000 (11:40 -0400)
committerMichael R Sweet <msweet@msweet.org>
Fri, 20 Sep 2024 15:40:28 +0000 (11:40 -0400)
scheduler/client.c
scheduler/main.c

index d47b84d0663f80549c721fb43134c858a51fb8e5..233f9017d27ebfdce31416a5731c9bb9ec4ed9ff 100644 (file)
@@ -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);
index c91f47710e9f61c7fdd3cd7085d8a601102c4a8b..a939cdae1fb8fa6d3ab2756f5f0c2d04a759d554 100644 (file)
@@ -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 */