mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-01 22:58:40 -04:00
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.
This commit is contained in:
parent
1081bca2a8
commit
21e877f3f6
1 changed files with 3 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue