Fix an issue with forking and signal socketpairs in select/poll backends

Nicholas Marriott identifies an issue where a signal socketpair
doesn't get recreated if the event backend doesn't set event_reinit.
This commit is contained in:
Nick Mathewson 2010-08-26 15:09:58 -04:00
parent 95b71d0cd6
commit f0ff7659f3

View File

@ -279,9 +279,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) {
@ -294,7 +299,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);