aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-07 16:39:15 +0000
committerChristian Grothoff <christian@grothoff.org>2016-09-07 16:39:15 +0000
commit1af63125b388d372e44eff1f8f61d843018a819d (patch)
treeb9d49d4f1b99717d27b82b0dd95e53cb3c1dc058
parent2a1c84ac2687ea9d743dae66fb9fda5cc99f368e (diff)
downloadlibmicrohttpd-1af63125b388d372e44eff1f8f61d843018a819d.tar.gz
libmicrohttpd-1af63125b388d372e44eff1f8f61d843018a819d.zip
-fix FTBFS on platforms that don't have epoll()-support
-rw-r--r--src/microhttpd/daemon.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 5dc63098..ec7a3526 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -933,6 +933,7 @@ finish_upgrade_close (struct MHD_UpgradeResponseHandle *urh)
933 DLL_remove (daemon->urh_head, 933 DLL_remove (daemon->urh_head,
934 daemon->urh_tail, 934 daemon->urh_tail,
935 urh); 935 urh);
936#if EPOLL_SUPPORT
936 if (0 != (daemon->options & MHD_USE_EPOLL)) 937 if (0 != (daemon->options & MHD_USE_EPOLL))
937 { 938 {
938 /* epoll documentation suggests that closing a FD 939 /* epoll documentation suggests that closing a FD
@@ -947,6 +948,7 @@ finish_upgrade_close (struct MHD_UpgradeResponseHandle *urh)
947 NULL)) 948 NULL))
948 MHD_PANIC (_("Failed to remove FD from epoll set\n")); 949 MHD_PANIC (_("Failed to remove FD from epoll set\n"));
949 } 950 }
951#endif
950 if (MHD_INVALID_SOCKET != urh->mhd.socket) 952 if (MHD_INVALID_SOCKET != urh->mhd.socket)
951 { 953 {
952 /* epoll documentation suggests that closing a FD 954 /* epoll documentation suggests that closing a FD
@@ -955,12 +957,14 @@ finish_upgrade_close (struct MHD_UpgradeResponseHandle *urh)
955 we are still seeing an event for this fd in epoll, 957 we are still seeing an event for this fd in epoll,
956 causing grief (use-after-free...) --- at least on my 958 causing grief (use-after-free...) --- at least on my
957 system. */ 959 system. */
960#if EPOLL_SUPPORT
958 if ( (0 != (daemon->options & MHD_USE_EPOLL)) && 961 if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
959 (0 != epoll_ctl (daemon->epoll_upgrade_fd, 962 (0 != epoll_ctl (daemon->epoll_upgrade_fd,
960 EPOLL_CTL_DEL, 963 EPOLL_CTL_DEL,
961 urh->mhd.socket, 964 urh->mhd.socket,
962 NULL)) ) 965 NULL)) )
963 MHD_PANIC (_("Failed to remove FD from epoll set\n")); 966 MHD_PANIC (_("Failed to remove FD from epoll set\n"));
967#endif
964 if (0 != MHD_socket_close_ (urh->mhd.socket)) 968 if (0 != MHD_socket_close_ (urh->mhd.socket))
965 MHD_PANIC (_("close failed\n")); 969 MHD_PANIC (_("close failed\n"));
966 } 970 }
@@ -1574,7 +1578,8 @@ recv_param_adapter (struct MHD_Connection *connection,
1574 (MHD_SCKT_SEND_SIZE_) i, 1578 (MHD_SCKT_SEND_SIZE_) i,
1575 MSG_NOSIGNAL); 1579 MSG_NOSIGNAL);
1576#ifdef EPOLL_SUPPORT 1580#ifdef EPOLL_SUPPORT
1577 if ( (0 > ret) && (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) ) 1581 if ( (0 > ret) &&
1582 (MHD_SCKT_ERR_IS_EAGAIN_ (MHD_socket_get_error_ ())) )
1578 { 1583 {
1579 /* Got EAGAIN --- no longer read-ready */ 1584 /* Got EAGAIN --- no longer read-ready */
1580 connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; 1585 connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY;
@@ -5154,7 +5159,6 @@ thread_failed:
5154 MHD_PANIC (_("Failed to remove FD from epoll set\n")); 5159 MHD_PANIC (_("Failed to remove FD from epoll set\n"));
5155 daemon->upgrade_fd_in_epoll = MHD_NO; 5160 daemon->upgrade_fd_in_epoll = MHD_NO;
5156 } 5161 }
5157#endif
5158 if (-1 != daemon->epoll_fd) 5162 if (-1 != daemon->epoll_fd)
5159 close (daemon->epoll_fd); 5163 close (daemon->epoll_fd);
5160#if HTTPS_SUPPORT 5164#if HTTPS_SUPPORT
@@ -5162,6 +5166,7 @@ thread_failed:
5162 close (daemon->epoll_upgrade_fd); 5166 close (daemon->epoll_upgrade_fd);
5163#endif 5167#endif
5164#endif 5168#endif
5169#endif
5165#ifdef DAUTH_SUPPORT 5170#ifdef DAUTH_SUPPORT
5166 free (daemon->nnc); 5171 free (daemon->nnc);
5167 (void) MHD_mutex_destroy_ (&daemon->nnc_lock); 5172 (void) MHD_mutex_destroy_ (&daemon->nnc_lock);