1
1

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>
Этот коммит содержится в:
Andrew Wiley 2021-05-07 12:38:00 -07:00 коммит произвёл Jakub Jelen
родитель 95539ba0eb
Коммит 1a831cfe2c

Просмотреть файл

@ -246,19 +246,17 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout)
}
#endif
if (fds[i].events & (POLLIN | POLLRDNORM)) {
FD_SET (fds[i].fd, &readfds);
}
// we use the readfds to get POLLHUP and POLLERR, which are provided even when not requested
FD_SET (fds[i].fd, &readfds);
if (fds[i].events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
FD_SET (fds[i].fd, &writefds);
}
if (fds[i].events & (POLLPRI | POLLRDBAND)) {
FD_SET (fds[i].fd, &exceptfds);
}
if (fds[i].fd > max_fd &&
(fds[i].events & (POLLIN | POLLOUT | POLLPRI |
POLLRDNORM | POLLRDBAND |
POLLWRNORM | POLLWRBAND))) {
if (fds[i].fd > max_fd) {
max_fd = fds[i].fd;
rc = 0;
}