aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGisle Vanem <gvanem@broadpark.no>2004-11-19 13:46:58 +0000
committerGisle Vanem <gvanem@broadpark.no>2004-11-19 13:46:58 +0000
commit2b403db8111a485468452ad7bfa6fb78145c8f5c (patch)
tree702280beef7adcf664e6dd7bf6fad492a586a011
parent03e7b7c95fc43f94eb44bf33a744c5e120fd2c11 (diff)
Winsock sockets are not in range 0..FD_SETSIZE.
Shouldn't Curl_select() use curl_socket_t ?
-rw-r--r--lib/select.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/select.c b/lib/select.c
index fb337d421..0b5af2614 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -33,6 +33,12 @@
#include "select.h"
+#ifdef WIN32
+#define VALID_SOCK(s) (1) /* Win-sockets are not in range [0..FD_SETSIZE> */
+#else
+#define VALID_SOCK(s) ((s) >= 0) && ((s) < FD_SETSIZE))
+#endif
+
/*
* This is an internal function used for waiting for read or write
* events on single file descriptors. It attempts to replace select()
@@ -104,7 +110,7 @@ int Curl_select(int readfd, int writefd, int timeout_ms)
FD_ZERO(&fds_read);
if (readfd != CURL_SOCKET_BAD) {
- if ((readfd < 0) || (readfd >= FD_SETSIZE)) {
+ if (!VALID_SOCK(readfd)) {
errno = EINVAL;
return -1;
}
@@ -115,7 +121,7 @@ int Curl_select(int readfd, int writefd, int timeout_ms)
FD_ZERO(&fds_write);
if (writefd != CURL_SOCKET_BAD) {
- if ((writefd < 0) || (writefd >= FD_SETSIZE)) {
+ if (!VALID_SOCK(writefd)) {
errno = EINVAL;
return -1;
}