[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 03/03: Added check for signed socket type
From: |
gnunet |
Subject: |
[libmicrohttpd] 03/03: Added check for signed socket type |
Date: |
Sun, 12 Nov 2023 18:16:50 +0100 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit b6737ab39b9df59acad1fe6fb7dc673ddf8e03db
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Nov 12 19:26:45 2023 +0300
Added check for signed socket type
---
configure.ac | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
src/microhttpd/daemon.c | 4 ++--
2 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index f2abfa43..e3cfba07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2120,6 +2120,55 @@ AS_VAR_IF([mhd_cv_fd_setsize_overridable],["no"],
[AC_DEFINE([HAS_FD_SETSIZE_OVERRIDABLE],[1],[Define to 1 i][f your system
allow overriding the value of FD_SETSIZE macro])]
)
+AC_CACHE_CHECK([whether socket value is a signed type],[mhd_cv_socket_signed],
+ [
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SOCKLIB_H
+#include <sockLib.h>
+#endif
+#if defined(_WIN32) && ! defined(__CYGWIN__)
+#include <winsock2.h>
+#endif
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+/* Keep in sync with microhttpd.h */
+#if ! defined(_WIN32) || defined(_SYS_TYPES_FD_SET)
+typedef int MHD_socket;
+#else /* defined(_WIN32) && ! defined(_SYS_TYPES_FD_SET) */
+typedef SOCKET MHD_socket;
+#endif /* defined(_WIN32) && ! defined(_SYS_TYPES_FD_SET) */
+
+int main(void)
+{
+ int test_arr[2 - 5*(!!(0 < ((MHD_socket)-1)))];
+ test_arr[1] = 0;
+ return test_arr[1];
+}
+ ]]
+ )
+ ],
+ [mhd_cv_socket_signed="yes"],
+ [mhd_cv_socket_signed="no"]
+ )
+ ]
+)
+AS_VAR_IF([mhd_cv_socket_signed],["yes"],
+ [AC_DEFINE([HAS_SIGNED_SOCKET],[1],[Define to 1 i][f your socket type is
signed])]
+)
MHD_CHECK_FUNC([writev],
[[#include <sys/uio.h>]],
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 32930a6f..b2420ca8 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -7409,7 +7409,7 @@ process_interim_params (struct MHD_Daemon *d,
{
(void) 0; /* Use MHD-created socket */
}
-#ifdef MHD_POSIX_SOCKETS
+#ifdef HAS_SIGNED_SOCKET
else if (0 > params->listen_fd)
{
#ifdef HAVE_MESSAGES
@@ -7419,7 +7419,7 @@ process_interim_params (struct MHD_Daemon *d,
#endif /* HAVE_MESSAGES */
return false;
}
-#endif /* MHD_POSIX_SOCKETS */
+#endif /* HAS_SIGNED_SOCKET */
else if (0 != (d->options & MHD_USE_NO_LISTEN_SOCKET))
{
#ifdef HAVE_MESSAGES
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.