mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-08 21:48:05 +02:00
libinput: Fix the close_restricted interface callback
libinput is supposed to take a close callback in its interface to allow you to call out to a privileged API to close FDs. But the FD that libinput passes you is bogus, because libinput_remove_source closes the FD on which it's passed. This is really bad, as the libinput_source really doesn't own the FD which it's passed, so it shouldn't be trying to close() it. Only one out of the four users of libinput_remove_source actually wants their FD closed, so move the close() call there. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6ae636fe18
commit
385bfdb762
2 changed files with 1 additions and 1 deletions
|
|
@ -714,6 +714,7 @@ touchpad_destroy(struct evdev_dispatch *dispatch)
|
||||||
struct libinput *libinput = touchpad->device->base.seat->libinput;
|
struct libinput *libinput = touchpad->device->base.seat->libinput;
|
||||||
|
|
||||||
touchpad->filter->interface->destroy(touchpad->filter);
|
touchpad->filter->interface->destroy(touchpad->filter);
|
||||||
|
close(touchpad->fsm.timer.fd);
|
||||||
libinput_remove_source(libinput, touchpad->fsm.timer.source);
|
libinput_remove_source(libinput, touchpad->fsm.timer.source);
|
||||||
free(touchpad->fsm.events);
|
free(touchpad->fsm.events);
|
||||||
free(dispatch);
|
free(dispatch);
|
||||||
|
|
|
||||||
|
|
@ -442,7 +442,6 @@ libinput_remove_source(struct libinput *libinput,
|
||||||
struct libinput_source *source)
|
struct libinput_source *source)
|
||||||
{
|
{
|
||||||
epoll_ctl(libinput->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL);
|
epoll_ctl(libinput->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL);
|
||||||
close(source->fd);
|
|
||||||
source->fd = -1;
|
source->fd = -1;
|
||||||
list_insert(&libinput->source_destroy_list, &source->link);
|
list_insert(&libinput->source_destroy_list, &source->link);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue