aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index af77644a..4ab43f9d 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -25,7 +25,6 @@
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include "platform_interface.h"
29#include "internal.h" 28#include "internal.h"
30#include "response.h" 29#include "response.h"
31#include "connection.h" 30#include "connection.h"
@@ -409,7 +408,7 @@ recv_tls_adapter (struct MHD_Connection *connection, void *other, size_t i)
409 if ( (GNUTLS_E_AGAIN == res) || 408 if ( (GNUTLS_E_AGAIN == res) ||
410 (GNUTLS_E_INTERRUPTED == res) ) 409 (GNUTLS_E_INTERRUPTED == res) )
411 { 410 {
412 errno = EINTR; 411 MHD_set_socket_errno_ (EINTR);
413#if EPOLL_SUPPORT 412#if EPOLL_SUPPORT
414 connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY; 413 connection->epoll_state &= ~MHD_EPOLL_STATE_READ_READY;
415#endif 414#endif
@@ -420,7 +419,7 @@ recv_tls_adapter (struct MHD_Connection *connection, void *other, size_t i)
420 /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication 419 /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication
421 disrupted); set errno to something caller will interpret 420 disrupted); set errno to something caller will interpret
422 correctly as a hard error */ 421 correctly as a hard error */
423 errno = EPIPE; 422 MHD_set_socket_errno_ (ECONNRESET);
424 return res; 423 return res;
425 } 424 }
426 if (res == i) 425 if (res == i)
@@ -450,7 +449,7 @@ send_tls_adapter (struct MHD_Connection *connection,
450 if ( (GNUTLS_E_AGAIN == res) || 449 if ( (GNUTLS_E_AGAIN == res) ||
451 (GNUTLS_E_INTERRUPTED == res) ) 450 (GNUTLS_E_INTERRUPTED == res) )
452 { 451 {
453 errno = EINTR; 452 MHD_set_socket_errno_ (EINTR);
454#if EPOLL_SUPPORT 453#if EPOLL_SUPPORT
455 connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY; 454 connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
456#endif 455#endif
@@ -732,13 +731,13 @@ MHD_handle_connection (void *data)
732 num_ready = SELECT (max + 1, &rs, &ws, NULL, tvp); 731 num_ready = SELECT (max + 1, &rs, &ws, NULL, tvp);
733 if (num_ready < 0) 732 if (num_ready < 0)
734 { 733 {
735 if (EINTR == errno) 734 if (EINTR == MHD_socket_errno_)
736 continue; 735 continue;
737#if HAVE_MESSAGES 736#if HAVE_MESSAGES
738 MHD_DLOG (con->daemon, 737 MHD_DLOG (con->daemon,
739 "Error during select (%d): `%s'\n", 738 "Error during select (%d): `%s'\n",
740 max, 739 max,
741 STRERROR (errno)); 740 MHD_socket_last_strerr_ ());
742#endif 741#endif
743 break; 742 break;
744 } 743 }
@@ -784,11 +783,11 @@ MHD_handle_connection (void *data)
784 if (poll (p, 1, 783 if (poll (p, 1,
785 (NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0) 784 (NULL == tvp) ? -1 : tv.tv_sec * 1000) < 0)
786 { 785 {
787 if (EINTR == errno) 786 if (EINTR == MHD_socket_errno_)
788 continue; 787 continue;
789#if HAVE_MESSAGES 788#if HAVE_MESSAGES
790 MHD_DLOG (con->daemon, "Error during poll: `%s'\n", 789 MHD_DLOG (con->daemon, "Error during poll: `%s'\n",
791 STRERROR (errno)); 790 MHD_socket_last_strerr_ ());
792#endif 791#endif
793 break; 792 break;
794 } 793 }
@@ -848,7 +847,7 @@ recv_param_adapter (struct MHD_Connection *connection,
848 if ( (MHD_INVALID_SOCKET == connection->socket_fd) || 847 if ( (MHD_INVALID_SOCKET == connection->socket_fd) ||
849 (MHD_CONNECTION_CLOSED == connection->state) ) 848 (MHD_CONNECTION_CLOSED == connection->state) )
850 { 849 {
851 errno = ENOTCONN; 850 MHD_set_socket_errno_ (ENOTCONN);
852 return -1; 851 return -1;
853 } 852 }
854 ret = RECV (connection->socket_fd, other, i, MSG_NOSIGNAL); 853 ret = RECV (connection->socket_fd, other, i, MSG_NOSIGNAL);
@@ -886,7 +885,7 @@ send_param_adapter (struct MHD_Connection *connection,
886 if ( (MHD_INVALID_SOCKET == connection->socket_fd) || 885 if ( (MHD_INVALID_SOCKET == connection->socket_fd) ||
887 (MHD_CONNECTION_CLOSED == connection->state) ) 886 (MHD_CONNECTION_CLOSED == connection->state) )
888 { 887 {
889 errno = ENOTCONN; 888 MHD_set_socket_errno_ (ENOTCONN);
890 return -1; 889 return -1;
891 } 890 }
892 if (0 != (connection->daemon->options & MHD_USE_SSL)) 891 if (0 != (connection->daemon->options & MHD_USE_SSL))
@@ -916,9 +915,10 @@ send_param_adapter (struct MHD_Connection *connection,
916#endif 915#endif
917 return ret; 916 return ret;
918 } 917 }
919 if ( (EINTR == errno) || (EAGAIN == errno) ) 918 const int err = MHD_socket_errno_;
919 if ( (EINTR == err) || (EAGAIN == err) || (EWOULDBLOCK == err) )
920 return 0; 920 return 0;
921 if ( (EINVAL == errno) || (EBADF == errno) ) 921 if ( (EINVAL == err) || (EBADF == err) )
922 return -1; 922 return -1;
923 /* None of the 'usual' sendfile errors occurred, so we should try 923 /* None of the 'usual' sendfile errors occurred, so we should try
924 to fall back to 'SEND'; see also this thread for info on 924 to fall back to 'SEND'; see also this thread for info on
@@ -1137,7 +1137,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1137#if HAVE_MESSAGES 1137#if HAVE_MESSAGES
1138 MHD_DLOG (daemon, 1138 MHD_DLOG (daemon,
1139 "Error allocating memory: %s\n", 1139 "Error allocating memory: %s\n",
1140 STRERROR (errno)); 1140 MHD_strerror_ (errno));
1141#endif 1141#endif
1142 if (0 != MHD_socket_close_ (client_socket)) 1142 if (0 != MHD_socket_close_ (client_socket))
1143 MHD_PANIC ("close failed\n"); 1143 MHD_PANIC ("close failed\n");
@@ -1152,7 +1152,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1152#if HAVE_MESSAGES 1152#if HAVE_MESSAGES
1153 MHD_DLOG (daemon, 1153 MHD_DLOG (daemon,
1154 "Error allocating memory: %s\n", 1154 "Error allocating memory: %s\n",
1155 STRERROR (errno)); 1155 MHD_strerror_ (errno));
1156#endif 1156#endif
1157 if (0 != MHD_socket_close_ (client_socket)) 1157 if (0 != MHD_socket_close_ (client_socket))
1158 MHD_PANIC ("close failed\n"); 1158 MHD_PANIC ("close failed\n");
@@ -1171,7 +1171,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1171#if HAVE_MESSAGES 1171#if HAVE_MESSAGES
1172 MHD_DLOG (daemon, 1172 MHD_DLOG (daemon,
1173 "Error allocating memory: %s\n", 1173 "Error allocating memory: %s\n",
1174 STRERROR (errno)); 1174 MHD_strerror_ (errno));
1175#endif 1175#endif
1176 if (0 != MHD_socket_close_ (client_socket)) 1176 if (0 != MHD_socket_close_ (client_socket))
1177 MHD_PANIC ("close failed\n"); 1177 MHD_PANIC ("close failed\n");
@@ -1211,7 +1211,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1211#if HAVE_MESSAGES 1211#if HAVE_MESSAGES
1212 MHD_DLOG (daemon, 1212 MHD_DLOG (daemon,
1213 "Failed to make socket non-blocking: %s\n", 1213 "Failed to make socket non-blocking: %s\n",
1214 STRERROR (errno)); 1214 MHD_socket_last_strerr_ ());
1215#endif 1215#endif
1216 } 1216 }
1217#else 1217#else
@@ -1221,7 +1221,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1221#if HAVE_MESSAGES 1221#if HAVE_MESSAGES
1222 MHD_DLOG (daemon, 1222 MHD_DLOG (daemon,
1223 "Failed to make socket non-blocking: %s\n", 1223 "Failed to make socket non-blocking: %s\n",
1224 STRERROR (errno)); 1224 MHD_socket_last_strerr_ ());
1225#endif 1225#endif
1226 } 1226 }
1227#endif 1227#endif
@@ -1299,7 +1299,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1299 eno = errno; 1299 eno = errno;
1300#if HAVE_MESSAGES 1300#if HAVE_MESSAGES
1301 MHD_DLOG (daemon, "Failed to create a thread: %s\n", 1301 MHD_DLOG (daemon, "Failed to create a thread: %s\n",
1302 STRERROR (res_thread_create)); 1302 MHD_strerror_ (res_thread_create));
1303#endif 1303#endif
1304 goto cleanup; 1304 goto cleanup;
1305 } 1305 }
@@ -1332,7 +1332,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1332#if HAVE_MESSAGES 1332#if HAVE_MESSAGES
1333 MHD_DLOG (daemon, 1333 MHD_DLOG (daemon,
1334 "Call to epoll_ctl failed: %s\n", 1334 "Call to epoll_ctl failed: %s\n",
1335 STRERROR (errno)); 1335 MHD_socket_last_strerr_ ());
1336#endif 1336#endif
1337 goto cleanup; 1337 goto cleanup;
1338 } 1338 }
@@ -1584,7 +1584,7 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1584#if HAVE_MESSAGES 1584#if HAVE_MESSAGES
1585 MHD_DLOG (daemon, 1585 MHD_DLOG (daemon,
1586 "Failed to make socket non-blocking: %s\n", 1586 "Failed to make socket non-blocking: %s\n",
1587 STRERROR (errno)); 1587 MHD_socket_last_strerr_ ());
1588#endif 1588#endif
1589 } 1589 }
1590 if (!GetHandleInformation ((HANDLE) sock, &dwFlags) || 1590 if (!GetHandleInformation ((HANDLE) sock, &dwFlags) ||
@@ -1592,10 +1592,9 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1592 !SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0))) 1592 !SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0)))
1593 { 1593 {
1594#if HAVE_MESSAGES 1594#if HAVE_MESSAGES
1595 SetErrnoFromWinError (GetLastError ());
1596 MHD_DLOG (daemon, 1595 MHD_DLOG (daemon,
1597 "Failed to make socket non-inheritable: %s\n", 1596 "Failed to make socket non-inheritable: %u\n",
1598 STRERROR (errno)); 1597 (unsigned int) GetLastError ());
1599#endif 1598#endif
1600 } 1599 }
1601#else 1600#else
@@ -1615,7 +1614,7 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1615#if HAVE_MESSAGES 1614#if HAVE_MESSAGES
1616 MHD_DLOG (daemon, 1615 MHD_DLOG (daemon,
1617 "Failed to make socket non-inheritable: %s\n", 1616 "Failed to make socket non-inheritable: %s\n",
1618 STRERROR (errno)); 1617 MHD_socket_last_strerr_ ());
1619#endif 1618#endif
1620 } 1619 }
1621#endif 1620#endif
@@ -1713,11 +1712,12 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
1713 if ((MHD_INVALID_SOCKET == s) || (addrlen <= 0)) 1712 if ((MHD_INVALID_SOCKET == s) || (addrlen <= 0))
1714 { 1713 {
1715#if HAVE_MESSAGES 1714#if HAVE_MESSAGES
1715 const int err = MHD_socket_errno_;
1716 /* This could be a common occurance with multiple worker threads */ 1716 /* This could be a common occurance with multiple worker threads */
1717 if ((EAGAIN != errno) && (EWOULDBLOCK != errno)) 1717 if ((EAGAIN != err) && (EWOULDBLOCK != err))
1718 MHD_DLOG (daemon, 1718 MHD_DLOG (daemon,
1719 "Error accepting connection: %s\n", 1719 "Error accepting connection: %s\n",
1720 STRERROR (errno)); 1720 MHD_socket_last_strerr_ ());
1721#endif 1721#endif
1722 if (MHD_INVALID_SOCKET != s) 1722 if (MHD_INVALID_SOCKET != s)
1723 { 1723 {
@@ -2094,10 +2094,10 @@ MHD_select (struct MHD_Daemon *daemon,
2094 return MHD_NO; 2094 return MHD_NO;
2095 if (num_ready < 0) 2095 if (num_ready < 0)
2096 { 2096 {
2097 if (EINTR == errno) 2097 if (EINTR == MHD_socket_errno_)
2098 return MHD_YES; 2098 return MHD_YES;
2099#if HAVE_MESSAGES 2099#if HAVE_MESSAGES
2100 MHD_DLOG (daemon, "select failed: %s\n", STRERROR (errno)); 2100 MHD_DLOG (daemon, "select failed: %s\n", MHD_socket_last_strerr_ ());
2101#endif 2101#endif
2102 return MHD_NO; 2102 return MHD_NO;
2103 } 2103 }
@@ -2193,12 +2193,12 @@ MHD_poll_all (struct MHD_Daemon *daemon,
2193 return MHD_YES; 2193 return MHD_YES;
2194 if (poll (p, poll_server + num_connections, timeout) < 0) 2194 if (poll (p, poll_server + num_connections, timeout) < 0)
2195 { 2195 {
2196 if (EINTR == errno) 2196 if (EINTR == MHD_socket_errno_)
2197 return MHD_YES; 2197 return MHD_YES;
2198#if HAVE_MESSAGES 2198#if HAVE_MESSAGES
2199 MHD_DLOG (daemon, 2199 MHD_DLOG (daemon,
2200 "poll failed: %s\n", 2200 "poll failed: %s\n",
2201 STRERROR (errno)); 2201 MHD_socket_last_strerr_ ());
2202#endif 2202#endif
2203 return MHD_NO; 2203 return MHD_NO;
2204 } 2204 }
@@ -2299,10 +2299,10 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
2299 return MHD_YES; 2299 return MHD_YES;
2300 if (poll (p, poll_count, timeout) < 0) 2300 if (poll (p, poll_count, timeout) < 0)
2301 { 2301 {
2302 if (EINTR == errno) 2302 if (EINTR == MHD_socket_errno_)
2303 return MHD_YES; 2303 return MHD_YES;
2304#if HAVE_MESSAGES 2304#if HAVE_MESSAGES
2305 MHD_DLOG (daemon, "poll failed: %s\n", STRERROR (errno)); 2305 MHD_DLOG (daemon, "poll failed: %s\n", MHD_socket_last_strerr_ ());
2306#endif 2306#endif
2307 return MHD_NO; 2307 return MHD_NO;
2308 } 2308 }
@@ -2396,7 +2396,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
2396 if (0 != (daemon->options & MHD_USE_DEBUG)) 2396 if (0 != (daemon->options & MHD_USE_DEBUG))
2397 MHD_DLOG (daemon, 2397 MHD_DLOG (daemon,
2398 "Call to epoll_ctl failed: %s\n", 2398 "Call to epoll_ctl failed: %s\n",
2399 STRERROR (errno)); 2399 MHD_socket_last_strerr_ ());
2400#endif 2400#endif
2401 return MHD_NO; 2401 return MHD_NO;
2402 } 2402 }
@@ -2442,13 +2442,13 @@ MHD_epoll (struct MHD_Daemon *daemon,
2442 events, MAX_EVENTS, timeout_ms); 2442 events, MAX_EVENTS, timeout_ms);
2443 if (-1 == num_events) 2443 if (-1 == num_events)
2444 { 2444 {
2445 if (EINTR == errno) 2445 if (EINTR == MHD_socket_errno_)
2446 return MHD_YES; 2446 return MHD_YES;
2447#if HAVE_MESSAGES 2447#if HAVE_MESSAGES
2448 if (0 != (daemon->options & MHD_USE_DEBUG)) 2448 if (0 != (daemon->options & MHD_USE_DEBUG))
2449 MHD_DLOG (daemon, 2449 MHD_DLOG (daemon,
2450 "Call to epoll_wait failed: %s\n", 2450 "Call to epoll_wait failed: %s\n",
2451 STRERROR (errno)); 2451 MHD_socket_last_strerr_ ());
2452#endif 2452#endif
2453 return MHD_NO; 2453 return MHD_NO;
2454 } 2454 }
@@ -3083,7 +3083,7 @@ create_socket (struct MHD_Daemon *daemon,
3083 /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo 3083 /* use SOCK_STREAM rather than ai_socktype: some getaddrinfo
3084 * implementations do not set ai_socktype, e.g. RHL6.2. */ 3084 * implementations do not set ai_socktype, e.g. RHL6.2. */
3085 fd = SOCKET (domain, ctype, protocol); 3085 fd = SOCKET (domain, ctype, protocol);
3086 if ( (MHD_INVALID_SOCKET == fd) && (EINVAL == errno) && (0 != SOCK_CLOEXEC) ) 3086 if ( (MHD_INVALID_SOCKET == fd) && (EINVAL == MHD_socket_errno_) && (0 != SOCK_CLOEXEC) )
3087 { 3087 {
3088 ctype = type; 3088 ctype = type;
3089 fd = SOCKET(domain, type, protocol); 3089 fd = SOCKET(domain, type, protocol);
@@ -3116,7 +3116,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3116 if (0 != (daemon->options & MHD_USE_DEBUG)) 3116 if (0 != (daemon->options & MHD_USE_DEBUG))
3117 MHD_DLOG (daemon, 3117 MHD_DLOG (daemon,
3118 "Call to epoll_create1 failed: %s\n", 3118 "Call to epoll_create1 failed: %s\n",
3119 STRERROR (errno)); 3119 MHD_socket_last_strerr_ ());
3120#endif 3120#endif
3121 return MHD_NO; 3121 return MHD_NO;
3122 } 3122 }
@@ -3136,7 +3136,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3136 if (0 != (daemon->options & MHD_USE_DEBUG)) 3136 if (0 != (daemon->options & MHD_USE_DEBUG))
3137 MHD_DLOG (daemon, 3137 MHD_DLOG (daemon,
3138 "Call to epoll_ctl failed: %s\n", 3138 "Call to epoll_ctl failed: %s\n",
3139 STRERROR (errno)); 3139 MHD_socket_last_strerr_ ());
3140#endif 3140#endif
3141 return MHD_NO; 3141 return MHD_NO;
3142 } 3142 }
@@ -3155,7 +3155,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3155 if (0 != (daemon->options & MHD_USE_DEBUG)) 3155 if (0 != (daemon->options & MHD_USE_DEBUG))
3156 MHD_DLOG (daemon, 3156 MHD_DLOG (daemon,
3157 "Call to epoll_ctl failed: %s\n", 3157 "Call to epoll_ctl failed: %s\n",
3158 STRERROR (errno)); 3158 MHD_socket_last_strerr_ ());
3159#endif 3159#endif
3160 return MHD_NO; 3160 return MHD_NO;
3161 } 3161 }
@@ -3274,7 +3274,7 @@ MHD_start_daemon_va (unsigned int flags,
3274#if HAVE_MESSAGES 3274#if HAVE_MESSAGES
3275 MHD_DLOG (daemon, 3275 MHD_DLOG (daemon,
3276 "Failed to create control pipe: %s\n", 3276 "Failed to create control pipe: %s\n",
3277 STRERROR (errno)); 3277 MHD_strerror_ (errno));
3278#endif 3278#endif
3279 free (daemon); 3279 free (daemon);
3280 return NULL; 3280 return NULL;
@@ -3342,7 +3342,7 @@ MHD_start_daemon_va (unsigned int flags,
3342#if HAVE_MESSAGES 3342#if HAVE_MESSAGES
3343 MHD_DLOG (daemon, 3343 MHD_DLOG (daemon,
3344 "Failed to allocate memory for nonce-nc map: %s\n", 3344 "Failed to allocate memory for nonce-nc map: %s\n",
3345 STRERROR (errno)); 3345 MHD_strerror_ (errno));
3346#endif 3346#endif
3347#if HTTPS_SUPPORT 3347#if HTTPS_SUPPORT
3348 if (0 != (flags & MHD_USE_SSL)) 3348 if (0 != (flags & MHD_USE_SSL))
@@ -3442,7 +3442,7 @@ MHD_start_daemon_va (unsigned int flags,
3442 if (0 != (flags & MHD_USE_DEBUG)) 3442 if (0 != (flags & MHD_USE_DEBUG))
3443 MHD_DLOG (daemon, 3443 MHD_DLOG (daemon,
3444 "Call to socket failed: %s\n", 3444 "Call to socket failed: %s\n",
3445 STRERROR (errno)); 3445 MHD_socket_last_strerr_ ());
3446#endif 3446#endif
3447 goto free_and_fail; 3447 goto free_and_fail;
3448 } 3448 }
@@ -3455,7 +3455,7 @@ MHD_start_daemon_va (unsigned int flags,
3455#if HAVE_MESSAGES 3455#if HAVE_MESSAGES
3456 MHD_DLOG (daemon, 3456 MHD_DLOG (daemon,
3457 "setsockopt failed: %s\n", 3457 "setsockopt failed: %s\n",
3458 STRERROR (errno)); 3458 MHD_socket_last_strerr_ ());
3459#endif 3459#endif
3460 } 3460 }
3461 3461
@@ -3515,7 +3515,7 @@ MHD_start_daemon_va (unsigned int flags,
3515#if HAVE_MESSAGES 3515#if HAVE_MESSAGES
3516 MHD_DLOG (daemon, 3516 MHD_DLOG (daemon,
3517 "setsockopt failed: %s\n", 3517 "setsockopt failed: %s\n",
3518 STRERROR (errno)); 3518 MHD_socket_last_strerr_ ());
3519#endif 3519#endif
3520 } 3520 }
3521#endif 3521#endif
@@ -3528,7 +3528,7 @@ MHD_start_daemon_va (unsigned int flags,
3528 MHD_DLOG (daemon, 3528 MHD_DLOG (daemon,
3529 "Failed to bind to port %u: %s\n", 3529 "Failed to bind to port %u: %s\n",
3530 (unsigned int) port, 3530 (unsigned int) port,
3531 STRERROR (errno)); 3531 MHD_socket_last_strerr_ ());
3532#endif 3532#endif
3533 if (0 != MHD_socket_close_ (socket_fd)) 3533 if (0 != MHD_socket_close_ (socket_fd))
3534 MHD_PANIC ("close failed\n"); 3534 MHD_PANIC ("close failed\n");
@@ -3543,7 +3543,7 @@ MHD_start_daemon_va (unsigned int flags,
3543#if HAVE_MESSAGES 3543#if HAVE_MESSAGES
3544 MHD_DLOG (daemon, 3544 MHD_DLOG (daemon,
3545 "Failed to make listen socket non-blocking: %s\n", 3545 "Failed to make listen socket non-blocking: %s\n",
3546 STRERROR (errno)); 3546 MHD_socket_last_strerr_ ());
3547#endif 3547#endif
3548 if (0 != MHD_socket_close_ (socket_fd)) 3548 if (0 != MHD_socket_close_ (socket_fd))
3549 MHD_PANIC ("close failed\n"); 3549 MHD_PANIC ("close failed\n");
@@ -3557,7 +3557,7 @@ MHD_start_daemon_va (unsigned int flags,
3557 if (0 != (flags & MHD_USE_DEBUG)) 3557 if (0 != (flags & MHD_USE_DEBUG))
3558 MHD_DLOG (daemon, 3558 MHD_DLOG (daemon,
3559 "Failed to listen for connections: %s\n", 3559 "Failed to listen for connections: %s\n",
3560 STRERROR (errno)); 3560 MHD_socket_last_strerr_ ());
3561#endif 3561#endif
3562 if (0 != MHD_socket_close_ (socket_fd)) 3562 if (0 != MHD_socket_close_ (socket_fd))
3563 MHD_PANIC ("close failed\n"); 3563 MHD_PANIC ("close failed\n");
@@ -3635,7 +3635,7 @@ MHD_start_daemon_va (unsigned int flags,
3635#if HAVE_MESSAGES 3635#if HAVE_MESSAGES
3636 MHD_DLOG (daemon, 3636 MHD_DLOG (daemon,
3637 "Failed to create listen thread: %s\n", 3637 "Failed to create listen thread: %s\n",
3638 STRERROR (res_thread_create)); 3638 MHD_strerror_ (res_thread_create));
3639#endif 3639#endif
3640 pthread_mutex_destroy (&daemon->cleanup_connection_mutex); 3640 pthread_mutex_destroy (&daemon->cleanup_connection_mutex);
3641 pthread_mutex_destroy (&daemon->per_ip_connection_mutex); 3641 pthread_mutex_destroy (&daemon->per_ip_connection_mutex);
@@ -3715,7 +3715,7 @@ MHD_start_daemon_va (unsigned int flags,
3715#if HAVE_MESSAGES 3715#if HAVE_MESSAGES
3716 MHD_DLOG (daemon, 3716 MHD_DLOG (daemon,
3717 "Failed to create worker control pipe: %s\n", 3717 "Failed to create worker control pipe: %s\n",
3718 STRERROR (errno)); 3718 MHD_strerror_ (errno));
3719#endif 3719#endif
3720 goto thread_failed; 3720 goto thread_failed;
3721 } 3721 }
@@ -3764,7 +3764,7 @@ MHD_start_daemon_va (unsigned int flags,
3764#if HAVE_MESSAGES 3764#if HAVE_MESSAGES
3765 MHD_DLOG (daemon, 3765 MHD_DLOG (daemon,
3766 "Failed to create pool thread: %s\n", 3766 "Failed to create pool thread: %s\n",
3767 STRERROR (res_thread_create)); 3767 MHD_strerror_ (res_thread_create));
3768#endif 3768#endif
3769 /* Free memory for this worker; cleanup below handles 3769 /* Free memory for this worker; cleanup below handles
3770 * all previously-created workers. */ 3770 * all previously-created workers. */