]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: check `MSG_NOSIGNAL` directly, drop detection and interim macro
authorViktor Szakats <commit@vsz.me>
Wed, 11 Feb 2026 03:10:00 +0000 (04:10 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 11 Feb 2026 13:51:08 +0000 (14:51 +0100)
Drop detecting it at configure time, along with the interim macro
`HAVE_MSG_NOSIGNAL`. There is no longer a reason for this workaround,
and allows to save the work at configure time and simplify.

Also say in a comment that `sys/socket.h` is defining this macro.

Follow-up to 77b3bc239daf75d9fb7702ee34c8e5871c47d387

Closes #20559

CMake/OtherTests.cmake
CMake/unix-cache.cmake
CMake/win32-cache.cmake
acinclude.m4
configure.ac
lib/curl_config-cmake.h.in
lib/curl_setup.h
lib/multi.c
lib/transfer.c

index 9f59e0dc8109d7907e92be77a28c1d73ec76f5ec..650a42d8bd2284065eb250998d1118787af50af6 100644 (file)
@@ -50,19 +50,6 @@ if(NOT DEFINED HAVE_STRUCT_SOCKADDR_STORAGE)
   cmake_pop_check_state()
 endif()
 
-if(NOT WIN32)
-  set(_source_epilogue "#undef inline")
-  curl_add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
-  check_c_source_compiles("${_source_epilogue}
-    #include <sys/socket.h>
-    int main(void)
-    {
-      int flag = MSG_NOSIGNAL;
-      (void)flag;
-      return 0;
-    }" HAVE_MSG_NOSIGNAL)
-endif()
-
 set(_source_epilogue "#undef inline")
 check_c_source_compiles("${_source_epilogue}
   #ifdef _MSC_VER
index bdde5f6a3d217d97a98b0de0d2917d5ee32bc662..5e26d12096d9906832ce8ea8035adc6f1ab6f12d 100644 (file)
@@ -179,7 +179,6 @@ if(APPLE OR
 else()
   set(HAVE_MEMRCHR 1)
 endif()
-set(HAVE_MSG_NOSIGNAL 1)
 set(HAVE_NETDB_H 1)
 if(ANDROID)
   set(HAVE_NETINET_IN6_H 1)
index 218d873b7dfad769eac2ca7ae55edbbafb022f5e..60d638f2d90bf46ffa7794ec8e5f4fafff494611 100644 (file)
@@ -125,7 +125,6 @@ set(HAVE_LINUX_TCP_H 0)
 set(HAVE_LOCALE_H 1)
 set(HAVE_LOCALTIME_R 0)
 set(HAVE_MEMRCHR 0)
-set(HAVE_MSG_NOSIGNAL 0)
 set(HAVE_NETDB_H 0)
 set(HAVE_NETINET_IN6_H 0)
 set(HAVE_NETINET_IN_H 0)
index 0f88afd2dedb63389df1bbb53aecdcfca700b4dc..646074fb656406952cb60a2bd8c23b81cde06197 100644 (file)
@@ -703,45 +703,6 @@ AC_DEFUN([CURL_CHECK_FUNC_SEND], [
   fi
 ])
 
-dnl CURL_CHECK_MSG_NOSIGNAL
-dnl -------------------------------------------------
-dnl Check for MSG_NOSIGNAL
-
-AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
-  AC_CHECK_HEADERS(sys/types.h)
-  AC_CACHE_CHECK([for MSG_NOSIGNAL], [curl_cv_msg_nosignal], [
-    AC_COMPILE_IFELSE([
-      AC_LANG_PROGRAM([[
-        #undef inline
-        #ifdef _WIN32
-        #ifndef WIN32_LEAN_AND_MEAN
-        #define WIN32_LEAN_AND_MEAN
-        #endif
-        #include <winsock2.h>
-        #else
-        #ifdef HAVE_SYS_TYPES_H
-        #include <sys/types.h>
-        #endif
-        #include <sys/socket.h>
-        #endif
-      ]],[[
-        int flag = MSG_NOSIGNAL;
-        (void)flag;
-      ]])
-    ],[
-      curl_cv_msg_nosignal="yes"
-    ],[
-      curl_cv_msg_nosignal="no"
-    ])
-  ])
-  case "$curl_cv_msg_nosignal" in
-    yes)
-      AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
-        [Define to 1 if you have the MSG_NOSIGNAL flag.])
-      ;;
-  esac
-])
-
 
 dnl CURL_CHECK_STRUCT_TIMEVAL
 dnl -------------------------------------------------
index 7697cdb154ffe2b74ebb6d6182e22b54ee4c8d47..4e08eafa42f73e8fc943699b38ea53828e03edc3 100644 (file)
@@ -4127,7 +4127,6 @@ CURL_CHECK_FUNC_SELECT
 
 CURL_CHECK_FUNC_RECV
 CURL_CHECK_FUNC_SEND
-CURL_CHECK_MSG_NOSIGNAL
 
 CURL_CHECK_FUNC_ALARM
 CURL_CHECK_FUNC_BASENAME
index e35b372ff198ee14bd005152ee0b0b001c94db95..f135f51be797698e8edc9dcfff4d2de9ecae8668 100644 (file)
 /* Define to 1 if you have the 'suseconds_t' data type. */
 #cmakedefine HAVE_SUSECONDS_T 1
 
-/* Define to 1 if you have the MSG_NOSIGNAL flag. */
-#cmakedefine HAVE_MSG_NOSIGNAL 1
-
 /* Define to 1 if you have the <netdb.h> header file. */
 #cmakedefine HAVE_NETDB_H 1
 
index eee3f3d09e4122747c5874dc43b718df5b4dbafa..478c94ead59d3384618c2a5c1593806554427fe5 100644 (file)
 #endif
 
 #ifndef _WIN32
-#include <sys/socket.h>
+#include <sys/socket.h>  /* also for MSG_NOSIGNAL */
 #endif
 
 #include "functypes.h"
@@ -880,7 +880,7 @@ struct timeval {
  * If we have the MSG_NOSIGNAL define, make sure we use
  * it as the fourth argument of function send()
  */
-#ifdef HAVE_MSG_NOSIGNAL
+#ifdef MSG_NOSIGNAL
 #define SEND_4TH_ARG MSG_NOSIGNAL
 #else
 #define SEND_4TH_ARG 0
index 20f4de2e6281c19bb71d81a6c5212e5c19f28422..9420e3f940b116af32ab383c91043c9c359867c7 100644 (file)
@@ -1852,7 +1852,7 @@ static void set_in_callback(struct Curl_multi *multi, bool value)
  */
 static void multi_posttransfer(struct Curl_easy *data)
 {
-#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL)
+#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(MSG_NOSIGNAL)
   /* restore the signal handler for SIGPIPE before we get back */
   if(!data->set.no_signal)
     signal(SIGPIPE, data->state.prev_signal);
index e25fe94a2aa4f7adff595563a2d8ded7eb10665e..32c31c6e9378298bd25affb9b90244128710ceed 100644 (file)
@@ -535,7 +535,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
      * different ports! */
     data->state.allow_port = TRUE;
 
-#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(HAVE_MSG_NOSIGNAL)
+#if defined(HAVE_SIGNAL) && defined(SIGPIPE) && !defined(MSG_NOSIGNAL)
     /*************************************************************
      * Tell signal handler to ignore SIGPIPE
      *************************************************************/