mirror of git://anongit.mindrot.org/openssh.git
Only return events from ppoll that were requested.
If the underlying system's select() returns bits that were not in the request set, our ppoll() implementation can return revents for events not requested, which can apparently cause a hang. Only return revents for activity in the requested event set. bz#3416, analysis and fix by yaroslav.kuzmin at vmssoftware com, ok djm@
This commit is contained in:
parent
5880200867
commit
bc04f2674a
|
@ -91,11 +91,11 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *tmoutp,
|
||||||
fds[i].revents = 0;
|
fds[i].revents = 0;
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
continue;
|
continue;
|
||||||
if (FD_ISSET(fd, readfds))
|
if ((fds[i].events & POLLIN) && FD_ISSET(fd, readfds))
|
||||||
fds[i].revents |= POLLIN;
|
fds[i].revents |= POLLIN;
|
||||||
if (FD_ISSET(fd, writefds))
|
if ((fds[i].events & POLLOUT) && FD_ISSET(fd, writefds))
|
||||||
fds[i].revents |= POLLOUT;
|
fds[i].revents |= POLLOUT;
|
||||||
if (FD_ISSET(fd, exceptfds))
|
if ((fds[i].events & POLLPRI) && FD_ISSET(fd, exceptfds))
|
||||||
fds[i].revents |= POLLPRI;
|
fds[i].revents |= POLLPRI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue