diff options
author | Iskren Chernev <iskren.chernev@gmail.com> | 2011-03-13 21:08:37 +0200 |
---|---|---|
committer | Iskren Chernev <iskren.chernev@gmail.com> | 2011-03-14 11:56:43 +0200 |
commit | 21e877f3f6ac0a5b88b69d0eb4850f962af3b4cb (patch) | |
tree | 27ef7f03e2014c96d5d783c560ca0ba83a90372d | |
parent | 1081bca2a802ef49d0f52d5613c50b016e0136cd (diff) |
Close signal file descriptor in event loop on remove and failure.
When the signal handler is removed the corresponding fd is closed. This
should automatically remove it from the epoll set.
-rw-r--r-- | wayland/event-loop.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/wayland/event-loop.c b/wayland/event-loop.c index afdb1d8..8708571 100644 --- a/wayland/event-loop.c +++ b/wayland/event-loop.c @@ -265,13 +265,10 @@ wl_event_source_signal_remove(struct wl_event_source *source) { struct wl_event_source_signal *signal_source = (struct wl_event_source_signal *) source; - struct wl_event_loop *loop = source->loop; - int fd; - fd = signal_source->fd; + close(signal_source->fd); free(source); - - return epoll_ctl(loop->epoll_fd, EPOLL_CTL_DEL, fd, NULL); + return 0; } struct wl_event_source_interface signal_source_interface = { @@ -315,6 +312,7 @@ wl_event_loop_add_signal(struct wl_event_loop *loop, ep.data.ptr = source; if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, source->fd, &ep) < 0) { + close(source->fd); free(source); return NULL; } |