diff options
author | Maxime Henrion <mhenrion@appnexus.com> | 2013-05-16 16:38:39 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-05-17 09:55:20 -0400 |
commit | 9b5a527f5bf898250a797dde59cadb4f64e8967a (patch) | |
tree | 3ab2e41cd03ab8be08b504f14db012135a1a9fdc /evmap.c | |
parent | 8ab612e396c286c753b23f974430cad0cd803147 (diff) | |
download | libevent-9b5a527f5bf898250a797dde59cadb4f64e8967a.tar.gz |
If evsel->del() fails, don't leave the evmap in an inconsistent state.
This fixes assertion failures in cases where epoll() fails with EBADF
-- the root cause for which is as of yet unknown. It seems something
(OpenSSL?) is closing the file descriptor under our feet.
Diffstat (limited to 'evmap.c')
-rw-r--r-- | evmap.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -375,9 +375,11 @@ evmap_io_del_(struct event_base *base, evutil_socket_t fd, struct event *ev) if (res) { void *extra = ((char*)ctx) + sizeof(struct evmap_io); - if (evsel->del(base, ev->ev_fd, old, res, extra) == -1) - return (-1); - retval = 1; + if (evsel->del(base, ev->ev_fd, old, res, extra) == -1) { + retval = -1; + } else { + retval = 1; + } } ctx->nread = nread; |