mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Fix a fencepost bug in the select backend
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.
This commit is contained in:
parent
dbb3c65288
commit
d90149d4b6
6
select.c
6
select.c
@ -172,9 +172,9 @@ select_dispatch(struct event_base *base, struct timeval *tv)
|
||||
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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user