mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 04:40:25 +01:00
Set O_CLOEXEC when opening devices
We'd rather keep these out of the hands of children. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
8e667070ff
commit
28ed7a6265
1 changed files with 4 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue