From ed7e0e77ed573d9f5b4123d7874de3efb02763d1 Mon Sep 17 00:00:00 2001 From: Niels Provos Date: Mon, 19 Jan 2009 23:40:11 +0000 Subject: [PATCH] bug fix and potentital race condition from Alexander Drozdov svn:r1025 --- event.c | 5 +++++ signal.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/event.c b/event.c index bc9e88b2..4a577b9d 100644 --- a/event.c +++ b/event.c @@ -390,8 +390,13 @@ event_reinit(struct event_base *base) /* prevent internal delete */ if (base->sig.ev_signal_added) { + /* we cannot call event_del here because the base has + * not been reinitialized yet. */ event_queue_remove(base, &base->sig.ev_signal, EVLIST_INSERTED); + if (base->sig.ev_signal.ev_flags & EVLIST_ACTIVE) + event_queue_remove(base, &base->sig.ev_signal, + EVLIST_ACTIVE); base->sig.ev_signal_added = 0; } diff --git a/signal.c b/signal.c index 4cbacd4c..2ceed2f3 100644 --- a/signal.c +++ b/signal.c @@ -311,9 +311,9 @@ evsig_process(struct event_base *base) ncalls = sig->evsigcaught[i]; if (ncalls == 0) continue; + sig->evsigcaught[i] -= ncalls; evmap_signal_active(base, i, ncalls); - sig->evsigcaught[i] = 0; } } -- 2.40.0