libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit dcb24300bdeb296335bae0c199d051ed92a92b48
parent 8629a47f831d7b6b56300039035c188fb6eaa65e
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Wed,  8 Nov 2023 17:03:29 +0300

Additional corrections for MHD_get_fdset2()

Diffstat:
Msrc/microhttpd/daemon.c | 20+++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1133,7 +1133,9 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, #endif #ifdef HAS_FD_SETSIZE_OVERRIDABLE - if (((unsigned int) INT_MAX) < fd_setsize) + if (0 == fd_setsize) + return MHD_NO; + else if (((unsigned int) INT_MAX) < fd_setsize) fd_setsize = (unsigned int) INT_MAX; #ifdef HAVE_MESSAGES else if (daemon->fdset_size > ((int) fd_setsize)) @@ -1141,20 +1143,20 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, if (daemon->fdset_size_set_by_app) { MHD_DLOG (daemon, - _ ("MHD_get_fdset2() called with fd_setsize (%u) " \ + _ ("%s() called with fd_setsize (%u) " \ "less than value set by MHD_OPTION_APP_FD_SETSIZE (%d). " \ - "Some socket FDs may be not added. " \ + "Some socket FDs may be not processed. " \ "Use MHD_OPTION_APP_FD_SETSIZE with the correct value.\n"), - fd_setsize, daemon->fdset_size); + "MHD_get_fdset2", fd_setsize, daemon->fdset_size); } else { MHD_DLOG (daemon, - _ ("MHD_get_fdset2() called with fd_setsize (%u) " \ + _ ("%s() called with fd_setsize (%u) " \ "less than FD_SETSIZE used by MHD (%d). " \ - "Some socket FDs may be not added. " \ + "Some socket FDs may be not processed. " \ "Consider using MHD_OPTION_APP_FD_SETSIZE option.\n"), - fd_setsize, daemon->fdset_size); + "MHD_get_fdset2", fd_setsize, daemon->fdset_size); } } #endif /* HAVE_MESSAGES */ @@ -1163,10 +1165,10 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, { #ifdef HAVE_MESSAGES MHD_DLOG (daemon, - _ ("MHD_get_fdset2() called with fd_setsize (%u) " \ + _ ("%s() called with fd_setsize (%u) " \ "less than fixed FD_SETSIZE value (%d) used on the " \ "platform.\n"), - fd_setsize, (int) FD_SETSIZE); + "MHD_get_fdset2", fd_setsize, (int) FD_SETSIZE); #endif /* HAVE_MESSAGES */ return MHD_NO; }