Small correction to poll semantics

This commit is contained in:
Tor Lillqvist 2018-09-19 17:18:29 +03:00
parent 8b5246b038
commit 5ee96e0271

View file

@ -196,12 +196,16 @@ static bool checkForPoll(std::vector<FakeSocketPair>& fds, struct pollfd *pollfd
if (pollfds[i].fd < 0 || pollfds[i].fd/2 >= fds.size()) if (pollfds[i].fd < 0 || pollfds[i].fd/2 >= fds.size())
{ {
pollfds[i].revents = POLLNVAL; pollfds[i].revents = POLLNVAL;
retval = true;
} }
else else
{ {
const int K = ((pollfds[i].fd)&1); const int K = ((pollfds[i].fd)&1);
if (fds[pollfds[i].fd/2].fd[K] == -1) if (fds[pollfds[i].fd/2].fd[K] == -1)
{
pollfds[i].revents = POLLNVAL; pollfds[i].revents = POLLNVAL;
retval = true;
}
else else
pollfds[i].revents = 0; pollfds[i].revents = 0;
} }