from trunk: do not insert event into list when evsel->add fails

svn:r661
This commit is contained in:
Niels Provos 2008-02-25 07:35:57 +00:00
parent b1341f056a
commit e1ab038bb5
2 changed files with 9 additions and 4 deletions

View File

@ -11,6 +11,7 @@ Changes in 1.4.2:
o update documentation of event_loop and event_base_loop; from Tani Hosokawa.
o detect integer types properly on platforms without stdint.h
o Remove "AM_MAINTAINER_MODE" declaration in configure.in: now makefiles and configure should get re-generated automatically when Makefile.am or configure.in chanes.
o do not insert event into list when evsel->add fails
Changes in 1.4.1-beta:
o free minheap on event_base_free(); from Christopher Layne

12
event.c
View File

@ -732,14 +732,18 @@ event_add(struct event *ev, struct timeval *tv)
if ((ev->ev_events & (EV_READ|EV_WRITE)) &&
!(ev->ev_flags & (EVLIST_INSERTED|EVLIST_ACTIVE))) {
event_queue_insert(base, ev, EVLIST_INSERTED);
int res = evsel->add(evbase, ev);
if (res != -1)
event_queue_insert(base, ev, EVLIST_INSERTED);
return (evsel->add(evbase, ev));
return (res);
} else if ((ev->ev_events & EV_SIGNAL) &&
!(ev->ev_flags & EVLIST_SIGNAL)) {
event_queue_insert(base, ev, EVLIST_SIGNAL);
int res = evsel->add(evbase, ev);
if (res != -1)
event_queue_insert(base, ev, EVLIST_SIGNAL);
return (evsel->add(evbase, ev));
return (res);
}
return (0);