diff options
author | Andreas Schneider <asn@cynapses.org> | 2010-06-17 11:19:05 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cynapses.org> | 2010-06-17 11:19:05 +0200 |
commit | edffc2a291521dba6e7de57cb1d70316a3dac66d (patch) | |
tree | c2ae1aabaa7b1871dfdb0030884b2f898b178702 | |
parent | c30a25e64c8318ed77e30a31fda0d9157caeafaf (diff) | |
download | libssh-edffc2a291521dba6e7de57cb1d70316a3dac66d.tar.gz libssh-edffc2a291521dba6e7de57cb1d70316a3dac66d.tar.xz libssh-edffc2a291521dba6e7de57cb1d70316a3dac66d.zip |
poll: Some code cleanup for easier debugging.
-rw-r--r-- | libssh/poll.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libssh/poll.c b/libssh/poll.c index f6a8174..94063d8 100644 --- a/libssh/poll.c +++ b/libssh/poll.c @@ -187,14 +187,16 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) { if (FD_ISSET(fds[i].fd, &readfds)) { int save_errno = errno; char data[64] = {0}; + int ret; /* support for POLLHUP */ + ret = recv(fds[i].fd, data, 64, MSG_PEEK); #ifdef _WIN32 - if ((recv(fds[i].fd, data, 64, MSG_PEEK) == -1) && + if (ret == -1) && (errno == WSAESHUTDOWN || errno == WSAECONNRESET || errno == WSAECONNABORTED || errno == WSAENETRESET)) { #else - if ((recv(fds[i].fd, data, 64, MSG_PEEK) == -1) && + if (ret == -1) && (errno == ESHUTDOWN || errno == ECONNRESET || errno == ECONNABORTED || errno == ENETRESET)) { #endif |