mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 18:29:50 +09:00
poll: Fixed a malfunction with wrong max fd value check.
This commit is contained in:
@@ -135,7 +135,7 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
|
||||
FD_ZERO (&exceptfds);
|
||||
|
||||
/* compute fd_sets and find largest descriptor */
|
||||
for (max_fd = -1, i = 0; i < nfds; i++) {
|
||||
for (max_fd = 0, i = 0; i < nfds; i++) {
|
||||
if (fds[i].fd < 0) {
|
||||
continue;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
|
||||
}
|
||||
}
|
||||
|
||||
if (max_fd == -1) {
|
||||
if (max_fd == (socket_t) -1) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user