mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-02 20:20:19 +01:00
udev: fix a race condition if a device disappears before we get a handle
If the device disappears too quickly, the device is NULL, the sysname is NULL and that causes a segfault in strcmp. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
a138069d5c
commit
413c29fef7
1 changed files with 2 additions and 0 deletions
|
|
@ -158,6 +158,8 @@ udev_input_add_devices(struct udev_input *input, struct udev *udev)
|
|||
udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
|
||||
path = udev_list_entry_get_name(entry);
|
||||
device = udev_device_new_from_syspath(udev, path);
|
||||
if (!device)
|
||||
continue;
|
||||
|
||||
sysname = udev_device_get_sysname(device);
|
||||
if (strncmp("event", sysname, 5) != 0) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue