diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-11-08 17:03:29 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-11-08 20:15:00 +0300 |
commit | dcb24300bdeb296335bae0c199d051ed92a92b48 (patch) | |
tree | 098f5842e368b2db46bc3576f161ba28356b6a07 | |
parent | 8629a47f831d7b6b56300039035c188fb6eaa65e (diff) | |
download | libmicrohttpd-dcb24300bdeb296335bae0c199d051ed92a92b48.tar.gz libmicrohttpd-dcb24300bdeb296335bae0c199d051ed92a92b48.zip |
Additional corrections for MHD_get_fdset2()
-rw-r--r-- | src/microhttpd/daemon.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 350c6056..20916a2f 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1133,7 +1133,9 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
1133 | #endif | 1133 | #endif |
1134 | 1134 | ||
1135 | #ifdef HAS_FD_SETSIZE_OVERRIDABLE | 1135 | #ifdef HAS_FD_SETSIZE_OVERRIDABLE |
1136 | if (((unsigned int) INT_MAX) < fd_setsize) | 1136 | if (0 == fd_setsize) |
1137 | return MHD_NO; | ||
1138 | else if (((unsigned int) INT_MAX) < fd_setsize) | ||
1137 | fd_setsize = (unsigned int) INT_MAX; | 1139 | fd_setsize = (unsigned int) INT_MAX; |
1138 | #ifdef HAVE_MESSAGES | 1140 | #ifdef HAVE_MESSAGES |
1139 | else if (daemon->fdset_size > ((int) fd_setsize)) | 1141 | else if (daemon->fdset_size > ((int) fd_setsize)) |
@@ -1141,20 +1143,20 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
1141 | if (daemon->fdset_size_set_by_app) | 1143 | if (daemon->fdset_size_set_by_app) |
1142 | { | 1144 | { |
1143 | MHD_DLOG (daemon, | 1145 | MHD_DLOG (daemon, |
1144 | _ ("MHD_get_fdset2() called with fd_setsize (%u) " \ | 1146 | _ ("%s() called with fd_setsize (%u) " \ |
1145 | "less than value set by MHD_OPTION_APP_FD_SETSIZE (%d). " \ | 1147 | "less than value set by MHD_OPTION_APP_FD_SETSIZE (%d). " \ |
1146 | "Some socket FDs may be not added. " \ | 1148 | "Some socket FDs may be not processed. " \ |
1147 | "Use MHD_OPTION_APP_FD_SETSIZE with the correct value.\n"), | 1149 | "Use MHD_OPTION_APP_FD_SETSIZE with the correct value.\n"), |
1148 | fd_setsize, daemon->fdset_size); | 1150 | "MHD_get_fdset2", fd_setsize, daemon->fdset_size); |
1149 | } | 1151 | } |
1150 | else | 1152 | else |
1151 | { | 1153 | { |
1152 | MHD_DLOG (daemon, | 1154 | MHD_DLOG (daemon, |
1153 | _ ("MHD_get_fdset2() called with fd_setsize (%u) " \ | 1155 | _ ("%s() called with fd_setsize (%u) " \ |
1154 | "less than FD_SETSIZE used by MHD (%d). " \ | 1156 | "less than FD_SETSIZE used by MHD (%d). " \ |
1155 | "Some socket FDs may be not added. " \ | 1157 | "Some socket FDs may be not processed. " \ |
1156 | "Consider using MHD_OPTION_APP_FD_SETSIZE option.\n"), | 1158 | "Consider using MHD_OPTION_APP_FD_SETSIZE option.\n"), |
1157 | fd_setsize, daemon->fdset_size); | 1159 | "MHD_get_fdset2", fd_setsize, daemon->fdset_size); |
1158 | } | 1160 | } |
1159 | } | 1161 | } |
1160 | #endif /* HAVE_MESSAGES */ | 1162 | #endif /* HAVE_MESSAGES */ |
@@ -1163,10 +1165,10 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, | |||
1163 | { | 1165 | { |
1164 | #ifdef HAVE_MESSAGES | 1166 | #ifdef HAVE_MESSAGES |
1165 | MHD_DLOG (daemon, | 1167 | MHD_DLOG (daemon, |
1166 | _ ("MHD_get_fdset2() called with fd_setsize (%u) " \ | 1168 | _ ("%s() called with fd_setsize (%u) " \ |
1167 | "less than fixed FD_SETSIZE value (%d) used on the " \ | 1169 | "less than fixed FD_SETSIZE value (%d) used on the " \ |
1168 | "platform.\n"), | 1170 | "platform.\n"), |
1169 | fd_setsize, (int) FD_SETSIZE); | 1171 | "MHD_get_fdset2", fd_setsize, (int) FD_SETSIZE); |
1170 | #endif /* HAVE_MESSAGES */ | 1172 | #endif /* HAVE_MESSAGES */ |
1171 | return MHD_NO; | 1173 | return MHD_NO; |
1172 | } | 1174 | } |