summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/select.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-09-24 14:04:49 (GMT)
committerBrad King <brad.king@kitware.com>2021-09-24 14:04:49 (GMT)
commit5b117bddd02f8df9d5994149f2017fb8989116bd (patch)
tree6f790721d7b287750faa5fd7336f6b36d3c42aba /Utilities/cmcurl/lib/select.h
parent71ea2d607d0294f44f03e2a8e34cbb6222edc3a4 (diff)
parentc4f76b28dcabdf9513a244eb1ce7d1431ae4d84d (diff)
downloadCMake-5b117bddd02f8df9d5994149f2017fb8989116bd.zip
CMake-5b117bddd02f8df9d5994149f2017fb8989116bd.tar.gz
CMake-5b117bddd02f8df9d5994149f2017fb8989116bd.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2021-09-22 (c7aef0a9)
Diffstat (limited to 'Utilities/cmcurl/lib/select.h')
-rw-r--r--Utilities/cmcurl/lib/select.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/Utilities/cmcurl/lib/select.h b/Utilities/cmcurl/lib/select.h
index 19da1e7..59a571d 100644
--- a/Utilities/cmcurl/lib/select.h
+++ b/Utilities/cmcurl/lib/select.h
@@ -97,8 +97,10 @@ int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
#if defined(TPF)
#define VALID_SOCK(x) 1
#define VERIFY_SOCK(x) Curl_nop_stmt
+#define FDSET_SOCK(x) 1
#elif defined(USE_WINSOCK)
#define VALID_SOCK(s) ((s) < INVALID_SOCKET)
+#define FDSET_SOCK(x) 1
#define VERIFY_SOCK(x) do { \
if(!VALID_SOCK(x)) { \
SET_SOCKERRNO(WSAEINVAL); \
@@ -106,17 +108,17 @@ int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
} \
} while(0)
#else
-#ifdef HAVE_POLL_FINE
-#define VALID_SOCK(s) ((s) >= 0) /* FD_SETSIZE is irrelevant for poll */
-#else
-#define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE))
-#endif
-#define VERIFY_SOCK(x) do { \
- if(!VALID_SOCK(x)) { \
- SET_SOCKERRNO(EINVAL); \
- return -1; \
- } \
-} while(0)
+#define VALID_SOCK(s) ((s) >= 0)
+
+/* If the socket is small enough to get set or read from an fdset */
+#define FDSET_SOCK(s) ((s) < FD_SETSIZE)
+
+#define VERIFY_SOCK(x) do { \
+ if(!VALID_SOCK(x) || !FDSET_SOCK(x)) { \
+ SET_SOCKERRNO(EINVAL); \
+ return -1; \
+ } \
+ } while(0)
#endif
#endif /* HEADER_CURL_SELECT_H */