aboutsummaryrefslogtreecommitdiff
path: root/src/poll.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-12-10 09:25:33 +0100
committerAndreas Schneider <asn@cryptomilk.org>2019-01-09 15:50:24 +0100
commitde54a88ee1b2eec67b064417d8b79774e7cd69a6 (patch)
tree5a7c54fc7cc2933efcb531a86a52a8fd1241d421 /src/poll.c
parent51f035aa3f2978709a531d46db07e28aec682020 (diff)
downloadlibssh-de54a88ee1b2eec67b064417d8b79774e7cd69a6.tar.gz
libssh-de54a88ee1b2eec67b064417d8b79774e7cd69a6.tar.xz
libssh-de54a88ee1b2eec67b064417d8b79774e7cd69a6.zip
poll: Return early for timeout and count every revent
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/poll.c')
-rw-r--r--src/poll.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/poll.c b/src/poll.c
index 01eb42d5..41231402 100644
--- a/src/poll.c
+++ b/src/poll.c
@@ -286,6 +286,10 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout)
if (rc < 0) {
return -1;
}
+ /* A timeout occured */
+ if (rc == 0) {
+ return 0;
+ }
for (rc = 0, i = 0; i < nfds; i++) {
if (fds[i].fd >= 0) {
@@ -303,7 +307,7 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout)
fds[i].revents |= fds[i].events & (POLLPRI | POLLRDBAND);
}
- if (fds[i].revents & ~POLLHUP) {
+ if (fds[i].revents != 0) {
rc++;
}
} else {