evdev: reset the device fd after closing it

A caller may have a reference to the device after closing it, make sure that
ref doesn't have a dangling fd so future attempts of reading from/writing to
the device fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2014-02-21 16:13:02 +10:00
parent 128f98c43b
commit d31b1b7b70

View file

@ -728,6 +728,7 @@ evdev_device_remove(struct evdev_device *device)
if (device->mtdev)
mtdev_close_delete(device->mtdev);
close_restricted(device->base.seat->libinput, device->fd);
device->fd = -1;
list_remove(&device->base.link);
notify_removed_device(&device->base);