/* 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",
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;