Skip to content

Commit

Permalink
Mirror fix for max-fds from 2.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Sep 20, 2024
1 parent e0630cd commit 96a330d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scheduler/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions scheduler/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down

0 comments on commit 96a330d

Please sign in to comment.