Skip to content

Commit d2b799b

Browse files
committed
Fixed bug in events monitoring reallocation
1 parent f8f86f6 commit d2b799b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ev.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,10 @@ static void ev_add_monitored(ev_context *ctx, int fd, int mask,
869869
* That is because FD_SETSIZE is fixed to 1024, fd_set is an array of 32
870870
* i32 and each FD is represented by a bit so 32 x 32 = 1024 as hard limit
871871
*/
872-
if (fd > ctx->maxevents) {
872+
if (fd >= ctx->maxevents) {
873873
int i = ctx->maxevents;
874874
ctx->maxevents = fd;
875-
if (fd > ctx->events_nr) {
875+
if (fd >= ctx->events_nr) {
876876
ctx->events_monitored =
877877
realloc(ctx->events_monitored, (fd + 1) * sizeof(struct ev));
878878
for (; i < ctx->maxevents; ++i)

0 commit comments

Comments
 (0)