- clear "revents" fields even when the call times out;
- do not call FD_ISSET with a negative file descriptor number.
Change-Id: I7aeaae79e73e39aed127a75495ea08256b18c182
highfd = -1;
for (i = 0; i < nfds; i++) {
+ p[i].revents = 0;
if (p[i].fd < 0)
continue;
if (p[i].fd >= FD_SETSIZE) {
rval = 0;
for (i = 0; i < nfds; i++) {
- p[i].revents = 0;
+ if (p[i].fd < 0)
+ continue;
if (FD_ISSET(p[i].fd, &rd))
p[i].revents |= POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI;
if (FD_ISSET(p[i].fd, &wr))