This bug would sometimes lead us to looking one bit off the end of
the fdset arrays, and trying to activate a (nonexistent) event if
that bit was set.
Found by Harlann Stenn. Fixes a test failure on OpenSolaris.
event_debug(("%s: select reports %d", __func__, res));
check_selectop(sop);
- i = random() % (nfds+1);
- for (j = 0; j <= nfds; ++j) {
- if (++i >= nfds+1)
+ i = random() % nfds;
+ for (j = 0; j < nfds; ++j) {
+ if (++i >= nfds)
i = 0;
res = 0;
if (FD_ISSET(i, sop->event_readset_out))