summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/poll.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-10-11 12:14:29 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-10-11 12:14:29 +0000
commit2483fa271906edb01c1aa9ea1a9c5c7e0fc6a8c0 (patch)
treec630d3bf82cb6d4d63582b5a6caf423906b6a3dc /winsup/cygwin/poll.cc
parent9f64fd80819b80513fadfe842622cf6d3853c1c0 (diff)
downloadcygnal-2483fa271906edb01c1aa9ea1a9c5c7e0fc6a8c0.tar.gz
cygnal-2483fa271906edb01c1aa9ea1a9c5c7e0fc6a8c0.tar.bz2
cygnal-2483fa271906edb01c1aa9ea1a9c5c7e0fc6a8c0.zip
* fhandler_socket.cc (fhandler_socket::evaluate_events): Handle
connect_state and af_local_connect connect call here, once, independent of FD_CONNECT being requested. Add comment to explain why. (fhandler_socket::connect): Drop connect_state handling and calling af_local_connect. Move remaining AF_LOCAL stuff prior to calling ::connect and explain why. Simplify error case. * poll.cc (poll): Handle connect state independently of POLLOUT being requested for the descriptor to allow setting POLLIN if connect failed. Add comment. * select.cc (set_bits): Drop connect_state and AF_LOCAL handling here.
Diffstat (limited to 'winsup/cygwin/poll.cc')
-rw-r--r--winsup/cygwin/poll.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc
index 17411a098..2b6f8a90a 100644
--- a/winsup/cygwin/poll.cc
+++ b/winsup/cygwin/poll.cc
@@ -115,8 +115,9 @@ poll (struct pollfd *fds, nfds_t nfds, int timeout)
So it looks like there's actually no good reason to
return POLLERR. */
fds[i].revents |= POLLIN;
- /* Handle failed connect. */
- if (FD_ISSET(fds[i].fd, write_fds)
+ /* Handle failed connect. A failed connect implicitly sets
+ POLLOUT, if requested, but it doesn't set POLLIN. */
+ if ((fds[i].events & POLLIN)
&& (sock = cygheap->fdtab[fds[i].fd]->is_socket ())
&& sock->connect_state () == connect_failed)
fds[i].revents |= (POLLIN | POLLERR);