diff --git a/libratbox/src/event.c b/libratbox/src/event.c index e39c03f8..1ee74672 100644 --- a/libratbox/src/event.c +++ b/libratbox/src/event.c @@ -88,6 +88,11 @@ rb_event_find(EVH * func, void *arg) struct ev_entry * rb_event_add(const char *name, EVH * func, void *arg, time_t when) { + if (rb_unlikely(when <= 0)) { + rb_lib_log("rb_event_add: tried to schedule %s event with a delay of " + "%d seconds", name, (int) when); + when = 1; + } struct ev_entry *ev; ev = rb_malloc(sizeof(struct ev_entry)); ev->func = func; @@ -109,6 +114,11 @@ rb_event_add(const char *name, EVH * func, void *arg, time_t when) struct ev_entry * rb_event_addonce(const char *name, EVH * func, void *arg, time_t when) { + if (rb_unlikely(when <= 0)) { + rb_lib_log("rb_event_addonce: tried to schedule %s event to run in " + "%d seconds", name, (int) when); + when = 1; + } struct ev_entry *ev; ev = rb_malloc(sizeof(struct ev_entry)); ev->func = func; diff --git a/modules/core/m_ban.c b/modules/core/m_ban.c index 08167757..bc175ce9 100644 --- a/modules/core/m_ban.c +++ b/modules/core/m_ban.c @@ -291,7 +291,8 @@ ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *p if(kline_queued == 0) { rb_event_addonce("check_klines", check_klines_event, NULL, - ConfigFileEntry.kline_delay); + ConfigFileEntry.kline_delay ? + ConfigFileEntry.kline_delay : 1); kline_queued = 1; } }