[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/02: Fixed build and socket init on macOS
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/02: Fixed build and socket init on macOS |
Date: |
Fri, 25 Dec 2020 18:18:56 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 9e846e522b3aa03277ab19244d40b2dd1109f7b3
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Dec 25 19:16:03 2020 +0300
Fixed build and socket init on macOS
---
src/microhttpd/mhd_sockets.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c
index ef3dc35d..fef7085c 100644
--- a/src/microhttpd/mhd_sockets.c
+++ b/src/microhttpd/mhd_sockets.c
@@ -516,10 +516,9 @@ MHD_socket_cork_ (MHD_socket sock,
(const void *) (on ? &on_val : &off_val),
sizeof (off_val)))
return 0; /* failed */
-#if defined(__FreeBSD__) && __FreeBSD__ + 0 >= 9
- /* FreeBSD do not need zero-send for flushing starting from version 9 */
+#if defined(_MHD_CORK_RESET_PUSH_DATA)
return 1;
-#elif defined(TCP_NOPUSH) && ! defined(TCP_CORK)
+#else /* ! _MHD_CORK_RESET_PUSH_DATA */
if (! on)
{
const int dummy = 0;
@@ -533,14 +532,13 @@ MHD_socket_cork_ (MHD_socket sock,
return 0; /* even force flush failed!? */
return 1; /* success */
}
-#else
- return 1; /* success */
-#endif
-#else
+ return 1;
+#endif /* ! _MHD_CORK_RESET_PUSH_DATA */
+#else /* ! MHD_TCP_CORK_NOPUSH */
/* do not have MHD_TCP_CORK_NOPUSH at all */
(void) sock; (void) on; /* Mute compiler warnings */
return 0;
-#endif
+#endif /* ! MHD_TCP_CORK_NOPUSH */
}
@@ -589,10 +587,13 @@ MHD_socket_create_listen_ (int pf)
fd = socket (pf,
SOCK_STREAM | SOCK_CLOEXEC | SOCK_NOSIGPIPE_OR_ZERO,
0);
- cloexec_set = (SOCK_CLOEXEC_OR_ZERO != 0);
+ if (MHD_INVALID_SOCKET != fd)
+ {
+ cloexec_set = (SOCK_CLOEXEC_OR_ZERO != 0);
#if defined(SOCK_NOSIGPIPE) || defined(MHD_socket_nosignal_)
- nosigpipe_set = (SOCK_NOSIGPIPE_OR_ZERO != 0);
+ nosigpipe_set = (SOCK_NOSIGPIPE_OR_ZERO != 0);
#endif /* SOCK_NOSIGPIPE || MHD_socket_nosignal_ */
+ }
#elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT)
fd = WSASocketW (pf,
SOCK_STREAM,
@@ -610,6 +611,9 @@ MHD_socket_create_listen_ (int pf)
SOCK_STREAM,
0);
cloexec_set = 0;
+#if defined(SOCK_NOSIGPIPE) || defined(MHD_socket_nosignal_)
+ nosigpipe_set = 0;
+#endif /* SOCK_NOSIGPIPE || MHD_socket_nosignal_ */
}
if (MHD_INVALID_SOCKET == fd)
return MHD_INVALID_SOCKET;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.