summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjerenkrantz <jerenkrantz@13f79535-47bb-0310-9956-ffa450edef68>2008-08-28 17:13:46 +0000
committerjerenkrantz <jerenkrantz@13f79535-47bb-0310-9956-ffa450edef68>2008-08-28 17:13:46 +0000
commit3244951f5822be30fc89aae8d4b694fe5177b200 (patch)
tree9583ddcb286b9ac3c3012fbe0dc452c65f0e6dc3
parenta3c264b4d8863588df5220c3d6c811875525e1e9 (diff)
downloadlibapr-3244951f5822be30fc89aae8d4b694fe5177b200.tar.gz
Backport r689896 from trunk:
Win32: Do not error out on apr_pollset_poll() when there are no sockets. * poll/unix/select.c (apr_pollset_poll): On Win32, short-circuit success if we have no sockets instead of returning an error. * CHANGES: Update. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.3.x@689897 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES3
-rw-r--r--poll/unix/select.c11
2 files changed, 13 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index d3e9cbf84..10597cd82 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,8 @@
-*- coding: utf-8 -*-
Changes for APR 1.3.4
-
+ *) Win32: Do not error out on apr_pollset_poll() when there are no sockets.
+ [Justin Erenkrantz]
Changes for APR 1.3.3
diff --git a/poll/unix/select.c b/poll/unix/select.c
index 42e7a3f68..044c95a85 100644
--- a/poll/unix/select.c
+++ b/poll/unix/select.c
@@ -340,6 +340,17 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
struct timeval tv, *tvptr;
fd_set readset, writeset, exceptset;
+#ifdef WIN32
+ /* On Win32, select() must be presented with at least one socket to
+ * poll on, or select() will return WSAEINVAL. So, we'll just
+ * short-circuit and bail now.
+ */
+ if (pollset->nelts == 0) {
+ (*num) = 0;
+ return APR_SUCCESS;
+ }
+#endif
+
if (timeout < 0) {
tvptr = NULL;
}