aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-06-17 11:19:05 +0200
committerAndreas Schneider <asn@cynapses.org>2010-06-17 11:23:58 +0200
commita1b9ae5048c1612650d7754c0d6db18304dedf09 (patch)
tree82fcbd7a8e493b13ca3d763950ec044b4cacd771
parenta375ebe29b7947a42d845f6f84c9129c0a8ee0aa (diff)
downloadlibssh-a1b9ae5048c1612650d7754c0d6db18304dedf09.tar.gz
libssh-a1b9ae5048c1612650d7754c0d6db18304dedf09.tar.xz
libssh-a1b9ae5048c1612650d7754c0d6db18304dedf09.zip
poll: Some code cleanup for easier debugging.
-rw-r--r--libssh/poll.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libssh/poll.c b/libssh/poll.c
index 5ce14b2b..7a25f33e 100644
--- a/libssh/poll.c
+++ b/libssh/poll.c
@@ -162,14 +162,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