diff options
author | Viktor Szakats <commit@vsz.me> | 2022-11-01 22:40:36 +0000 |
---|---|---|
committer | Viktor Szakats <commit@vsz.me> | 2022-11-01 22:40:36 +0000 |
commit | edae6c66c7444a59224a56c360d8fa5e4a7b86db (patch) | |
tree | 4ae139357599b9ef97dd5f83e5a802330781d336 /CMakeLists.txt | |
parent | b563a92cd6797ec40d7cd73d51f9c31e637463f4 (diff) | |
download | curl-edae6c66c7444a59224a56c360d8fa5e4a7b86db.tar.gz |
lib: sync guard for Curl_getaddrinfo_ex() definition and use
`Curl_getaddrinfo_ex()` gets _defined_ with `HAVE_GETADDRINFO` set. But,
`hostip4.c` _used_ it with `HAVE_GETADDRINFO_THREADSAFE` set alone. It
meant a build with the latter, but without the former flag could result
in calling this function but not defining it, and failing to link.
Patch this by adding an extra check for `HAVE_GETATTRINFO` around the
call.
Before this patch, build systems prevented this condition. Now they
don't need to.
While here, simplify the related CMake logic on Windows by setting
`HAVE_GETADDRINFO_THREADSAFE` to the detection result of
`HAVE_GETADDRINFO`. This expresses the following intent clearer than
the previous patch and keeps the logic in a single block of code:
When we have `getaddrinfo()` on Windows, it's always threadsafe.
Follow-up to 67d88626d44ec04b9e11dca4cfbf62cd29fe9781
Reviewed-by: Jay Satiro
Closes #9734
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6719c872a..13aff5f4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1077,8 +1077,8 @@ check_symbol_exists(_strtoi64 "${CURL_INCLUDES}" HAVE__STRTOI64) check_symbol_exists(strerror_r "${CURL_INCLUDES}" HAVE_STRERROR_R) check_symbol_exists(siginterrupt "${CURL_INCLUDES}" HAVE_SIGINTERRUPT) check_symbol_exists(getaddrinfo "${CURL_INCLUDES}" HAVE_GETADDRINFO) -if(NOT HAVE_GETADDRINFO) - set(HAVE_GETADDRINFO_THREADSAFE OFF) +if(WIN32) + set(HAVE_GETADDRINFO_THREADSAFE ${HAVE_GETADDRINFO}) endif() check_symbol_exists(freeaddrinfo "${CURL_INCLUDES}" HAVE_FREEADDRINFO) check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE) |