From 69c472a541a0646c919c5b51e61f34572cfb102a Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Tue, 8 Dec 2015 19:35:45 +0000 Subject: MHD_get_fdset() & MHD_get_fdset2(): continue to add FDs to sets in case of error. --- src/microhttpd/daemon.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 219fb1be..95e6d4c4 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c @@ -714,6 +714,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, unsigned int fd_setsize) { struct MHD_Connection *pos; + int result = MHD_YES; if ( (NULL == daemon) || (NULL == read_fd_set) @@ -733,7 +734,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, #endif if (MHD_INVALID_SOCKET != daemon->socket_fd && MHD_YES != add_to_fd_set (daemon->socket_fd, read_fd_set, max_fd, fd_setsize)) - return MHD_NO; + result = MHD_NO; for (pos = daemon->connections_head; NULL != pos; pos = pos->next) { @@ -741,19 +742,19 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, { case MHD_EVENT_LOOP_INFO_READ: if (MHD_YES != add_to_fd_set (pos->socket_fd, read_fd_set, max_fd, fd_setsize)) - return MHD_NO; + result = MHD_NO; break; case MHD_EVENT_LOOP_INFO_WRITE: if (MHD_YES != add_to_fd_set (pos->socket_fd, write_fd_set, max_fd, fd_setsize)) - return MHD_NO; + result = MHD_NO; if (pos->read_buffer_size > pos->read_buffer_offset && MHD_YES != add_to_fd_set (pos->socket_fd, read_fd_set, max_fd, fd_setsize)) - return MHD_NO; + result = MHD_NO; break; case MHD_EVENT_LOOP_INFO_BLOCK: if (pos->read_buffer_size > pos->read_buffer_offset && MHD_YES != add_to_fd_set (pos->socket_fd, read_fd_set, max_fd, fd_setsize)) - return MHD_NO; + result = MHD_NO; break; case MHD_EVENT_LOOP_INFO_CLEANUP: /* this should never happen */ @@ -768,7 +769,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon, *max_fd); #endif #endif - return MHD_YES; + return result; } -- cgit v1.2.3