]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Limit the maximum number of file descriptors to 64k-1 (Issue #989)
authorMichael R Sweet <msweet@msweet.org>
Thu, 20 Jun 2024 12:51:26 +0000 (08:51 -0400)
committerMichael R Sweet <msweet@msweet.org>
Thu, 20 Jun 2024 12:51:26 +0000 (08:51 -0400)
CHANGES.md
scheduler/main.c

index 4a2e25d5d6348c76c974083e1a013718410bc736..64baa4fae0a9237003e765dfdbf51a6856979428 100644 (file)
@@ -1,8 +1,15 @@
-CHANGES - OpenPrinting CUPS 2.4.10 - (2024-06-18)
-================================================
+CHANGES - OpenPrinting CUPS
+===========================
+
+
+Changes in CUPS v2.4.11 (YYYY-MM-DD)
+------------------------------------
+
+- Updated the maximum file descriptor limit for `cupsd` to 64k-1 (Issue #989)
+
 
 Changes in CUPS v2.4.10 (2024-06-18)
------------------------------
+------------------------------------
 
 - Fixed error handling when reading a mixed `1setOf` attribute.
 - Fixed scheduler start if there is only domain socket to listen on (Issue #985)
index ae2409e02ad8b9b3850551d2731cfd4465a19ba7..c91f47710e9f61c7fdd3cd7085d8a601102c4a8b 100644 (file)
@@ -519,22 +519,19 @@ main(int  argc,                           /* I - Number of command-line args */
 #endif /* HAVE_DBUS_THREADS_INIT */
 
  /*
-  * Set the maximum number of files...
+  * Set the maximum number of files, which for practical reasons can be limited
+  * to the number of TCP port number values (64k-1)...
   */
 
   getrlimit(RLIMIT_NOFILE, &limit);
 
 #if !defined(HAVE_POLL) && !defined(HAVE_EPOLL) && !defined(HAVE_KQUEUE)
-  if (limit.rlim_max > FD_SETSIZE)
+  if ((MaxFDs = limit.rlim_max) > FD_SETSIZE)
     MaxFDs = FD_SETSIZE;
-  else
-#endif /* !HAVE_POLL && !HAVE_EPOLL && !HAVE_KQUEUE */
-#ifdef RLIM_INFINITY
-  if (limit.rlim_max == RLIM_INFINITY)
-    MaxFDs = 16384;
-  else
+#else
+  if ((MaxFDs = limit.rlim_max) > 65535)
+    MaxFDs = 65535;
 #endif /* RLIM_INFINITY */
-    MaxFDs = limit.rlim_max;
 
   limit.rlim_cur = (rlim_t)MaxFDs;