mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Make sure max_dispatch_callbacks is never negative
Suggested by Alexander Drozdov.
This commit is contained in:
parent
fd4de1e7fe
commit
9fa56bdf1c
5
event.c
5
event.c
@ -923,7 +923,7 @@ event_config_new(void)
|
||||
|
||||
TAILQ_INIT(&cfg->entries);
|
||||
cfg->max_dispatch_interval.tv_sec = -1;
|
||||
cfg->max_dispatch_callbacks = -1;
|
||||
cfg->max_dispatch_callbacks = INT_MAX;
|
||||
|
||||
return (cfg);
|
||||
}
|
||||
@ -1002,7 +1002,8 @@ event_config_set_max_dispatch_interval(struct event_config *cfg,
|
||||
sizeof(struct timeval));
|
||||
else
|
||||
cfg->max_dispatch_interval.tv_sec = -1;
|
||||
cfg->max_dispatch_callbacks = max_callbacks;
|
||||
cfg->max_dispatch_callbacks =
|
||||
max_callbacks >= 0 ? max_callbacks : INT_MAX ;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user