[PATCH libinput] Set O_CLOEXEC when opening devices

Peter Hutterer peter.hutterer at who-t.net
Thu Apr 30 15:58:28 PDT 2015


On Thu, Apr 30, 2015 at 11:43:28AM -0500, Derek Foreman wrote:
> We'd rather keep these out of the hands of children.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---

merged, thanks.

Cheers,
   Peter

>  src/evdev.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/evdev.c b/src/evdev.c
> index d997d24..af36127 100644
> --- a/src/evdev.c
> +++ b/src/evdev.c
> @@ -1953,7 +1953,8 @@ evdev_device_create(struct libinput_seat *seat,
>  	/* Use non-blocking mode so that we can loop on read on
>  	 * evdev_device_data() until all events on the fd are
>  	 * read.  mtdev_get() also expects this. */
> -	fd = open_restricted(libinput, devnode, O_RDWR | O_NONBLOCK);
> +	fd = open_restricted(libinput, devnode,
> +			     O_RDWR | O_NONBLOCK | O_CLOEXEC);
>  	if (fd < 0) {
>  		log_info(libinput,
>  			 "opening input device '%s' failed (%s).\n",
> @@ -2436,7 +2437,8 @@ evdev_device_resume(struct evdev_device *device)
>  		return -ENODEV;
>  
>  	devnode = udev_device_get_devnode(device->udev_device);
> -	fd = open_restricted(libinput, devnode, O_RDWR | O_NONBLOCK);
> +	fd = open_restricted(libinput, devnode,
> +			     O_RDWR | O_NONBLOCK | O_CLOEXEC);
>  
>  	if (fd < 0)
>  		return -errno;
> -- 
> 2.1.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 


More information about the wayland-devel mailing list