Commit 9196c482 authored by Martin Sustrik's avatar Martin Sustrik

select version zmq_poll reports invalid FDs

Till now, passing invalid file descriptor to zmq_poll()
caused asseration. Now it returns error.
Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent 93800985
...@@ -592,12 +592,19 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) ...@@ -592,12 +592,19 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
memcpy (&errset, &pollset_err, sizeof (fd_set)); memcpy (&errset, &pollset_err, sizeof (fd_set));
#if defined ZMQ_HAVE_WINDOWS #if defined ZMQ_HAVE_WINDOWS
int rc = select (0, &inset, &outset, &errset, ptimeout); int rc = select (0, &inset, &outset, &errset, ptimeout);
wsa_assert (rc != SOCKET_ERROR); if (unlikely (rc == SOCKET_ERROR)) {
wsa_error_to_errno ();
if (errno == ENOTSOCK)
return -1;
wsa_assert (false);
}
#else #else
int rc = select (maxfd + 1, &inset, &outset, &errset, ptimeout); int rc = select (maxfd + 1, &inset, &outset, &errset, ptimeout);
if (rc == -1 && errno == EINTR) if (unlikely (rc == -1) {
return -1; if (errno == EINTR || errno == EBADF)
errno_assert (rc >= 0); return -1;
errno_assert (false);
}
#endif #endif
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment