Skip to content

Commit 96a330d

Browse files
committed
Mirror fix for max-fds from 2.5.
1 parent e0630cd commit 96a330d

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

scheduler/client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
8080
* Make sure we don't have a full set of clients already...
8181
*/
8282

83-
if (cupsArrayCount(Clients) == MaxClients)
83+
if (MaxClients > 0 && cupsArrayCount(Clients) >= MaxClients)
8484
return;
8585

8686
cupsdSetBusyState(1);

scheduler/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,14 @@ main(int argc, /* I - Number of command-line args */
523523
* to the number of TCP port number values (64k-1)...
524524
*/
525525

526+
limit.rlim_max = 0;
526527
getrlimit(RLIMIT_NOFILE, &limit);
527528

528529
#if !defined(HAVE_POLL) && !defined(HAVE_EPOLL) && !defined(HAVE_KQUEUE)
529-
if ((MaxFDs = limit.rlim_max) > FD_SETSIZE)
530+
if ((MaxFDs = limit.rlim_max) > FD_SETSIZE || MaxFDs <= 0)
530531
MaxFDs = FD_SETSIZE;
531532
#else
532-
if ((MaxFDs = limit.rlim_max) > 65535)
533+
if ((MaxFDs = limit.rlim_max) > 65535 || MaxFDs <= 0)
533534
MaxFDs = 65535;
534535
#endif /* RLIM_INFINITY */
535536

0 commit comments

Comments
 (0)