From ebf860fb8fb6a49adf0e288e5b3ef41376fffda6 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 30 Aug 2010 07:54:30 +0000 Subject: Fix from upstream to make all backends reinit on event_reinit(). This was not being done for poll and select, so after fork they would remain using the same socketpair for signal notification, leading to a race between the two processes to read from it and hangs. Problem originally reported by kili@. ok gilles --- lib/libevent/event.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libevent/event.c b/lib/libevent/event.c index 5bca0683815..81f8a97a8f4 100644 --- a/lib/libevent/event.c +++ b/lib/libevent/event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: event.c,v 1.24 2010/07/12 18:03:38 nicm Exp $ */ +/* $OpenBSD: event.c,v 1.25 2010/08/30 07:54:29 nicm Exp $ */ /* * Copyright (c) 2000-2004 Niels Provos @@ -281,9 +281,14 @@ event_reinit(struct event_base *base) int res = 0; struct event *ev; +#if 0 + /* Right now, reinit always takes effect, since even if the + backend doesn't require it, the signal socketpair code does. + */ /* check if this event mechanism requires reinit */ if (!evsel->need_reinit) return (0); +#endif /* prevent internal delete */ if (base->sig.ev_signal_added) { @@ -296,7 +301,7 @@ event_reinit(struct event_base *base) EVLIST_ACTIVE); base->sig.ev_signal_added = 0; } - + if (base->evsel->dealloc != NULL) base->evsel->dealloc(base, base->evbase); evbase = base->evbase = evsel->init(base); -- cgit v1.2.3