mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
emulated poll: polling for nothing should at least get socket errors
Signed-off-by: Andrew Wiley <wiley@outlook.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Jakub Jelen
parent
95539ba0eb
commit
1a831cfe2c
12
src/poll.c
12
src/poll.c
@@ -246,19 +246,17 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (fds[i].events & (POLLIN | POLLRDNORM)) {
|
// we use the readfds to get POLLHUP and POLLERR, which are provided even when not requested
|
||||||
FD_SET (fds[i].fd, &readfds);
|
FD_SET (fds[i].fd, &readfds);
|
||||||
}
|
|
||||||
if (fds[i].events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
|
if (fds[i].events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
|
||||||
FD_SET (fds[i].fd, &writefds);
|
FD_SET (fds[i].fd, &writefds);
|
||||||
}
|
}
|
||||||
if (fds[i].events & (POLLPRI | POLLRDBAND)) {
|
if (fds[i].events & (POLLPRI | POLLRDBAND)) {
|
||||||
FD_SET (fds[i].fd, &exceptfds);
|
FD_SET (fds[i].fd, &exceptfds);
|
||||||
}
|
}
|
||||||
if (fds[i].fd > max_fd &&
|
|
||||||
(fds[i].events & (POLLIN | POLLOUT | POLLPRI |
|
if (fds[i].fd > max_fd) {
|
||||||
POLLRDNORM | POLLRDBAND |
|
|
||||||
POLLWRNORM | POLLWRBAND))) {
|
|
||||||
max_fd = fds[i].fd;
|
max_fd = fds[i].fd;
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user