diff options
Diffstat (limited to 'lib/tevent/tevent_standard.c')
-rw-r--r-- | lib/tevent/tevent_standard.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c index 3a674152b1..5d73db55b0 100644 --- a/lib/tevent/tevent_standard.c +++ b/lib/tevent/tevent_standard.c @@ -392,7 +392,10 @@ static int std_event_fd_destructor(struct tevent_fd *fde) epoll_del_event(std_ev, fde); - if (fde->flags & TEVENT_FD_AUTOCLOSE) { + if (fde->close_fn) { + fde->close_fn(ev, fde, fde->fd, fde->private_data); + fde->fd = -1; + } else if (fde->flags & TEVENT_FD_AUTOCLOSE) { close(fde->fd); fde->fd = -1; } @@ -584,6 +587,7 @@ static int std_event_loop_wait(struct tevent_context *ev) static const struct tevent_ops std_event_ops = { .context_init = std_event_context_init, .add_fd = std_event_add_fd, + .set_fd_close_fn= tevent_common_fd_set_close_fn, .get_fd_flags = tevent_common_fd_get_flags, .set_fd_flags = std_event_set_fd_flags, .add_timer = tevent_common_add_timer, |