On Sat, Mar 01, 2014 at 02:19:03PM -0500, Jasper St. Pierre wrote:
> 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.

pushed, thanks.

Cheers,
   Peter

> ---
>  src/evdev-touchpad.c | 1 +
>  src/libinput.c       | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c
> index 8185bf2..65c5ea0 100644
> --- a/src/evdev-touchpad.c
> +++ b/src/evdev-touchpad.c
> @@ -714,6 +714,7 @@ touchpad_destroy(struct evdev_dispatch *dispatch)
>       struct libinput *libinput = touchpad->device->base.seat->libinput;
>  
>       touchpad->filter->interface->destroy(touchpad->filter);
> +     close(touchpad->fsm.timer.fd);
>       libinput_remove_source(libinput, touchpad->fsm.timer.source);
>       free(touchpad->fsm.events);
>       free(dispatch);
> diff --git a/src/libinput.c b/src/libinput.c
> index 58b87b0..182c401 100644
> --- a/src/libinput.c
> +++ b/src/libinput.c
> @@ -442,7 +442,6 @@ libinput_remove_source(struct libinput *libinput,
>                      struct libinput_source *source)
>  {
>       epoll_ctl(libinput->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL);
> -     close(source->fd);
>       source->fd = -1;
>       list_insert(&libinput->source_destroy_list, &source->link);
>  }
> -- 
> 1.8.5.3
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to