mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-30 06:00:07 +01:00
replace strncmp with strneq for safety-check
Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
This commit is contained in:
parent
5e69c5f9ae
commit
c00c5cb691
4 changed files with 5 additions and 5 deletions
|
|
@ -184,7 +184,7 @@ udev_input_add_devices(struct udev_input *input, struct udev *udev)
|
|||
continue;
|
||||
|
||||
sysname = udev_device_get_sysname(device);
|
||||
if (strncmp("event", sysname, 5) != 0) {
|
||||
if (!strneq("event", sysname, 5)) {
|
||||
udev_device_unref(device);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ evdev_udev_handler(void *data)
|
|||
if (!action)
|
||||
goto out;
|
||||
|
||||
if (strncmp("event", udev_device_get_sysname(udev_device), 5) != 0)
|
||||
if (!strneq("event", udev_device_get_sysname(udev_device), 5))
|
||||
goto out;
|
||||
|
||||
if (streq(action, "add"))
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ START_TEST(path_device_sysname)
|
|||
ck_assert_notnull(sysname);
|
||||
ck_assert_int_gt(strlen(sysname), 1);
|
||||
ck_assert(strchr(sysname, '/') == NULL);
|
||||
ck_assert_int_eq(strncmp(sysname, "event", 5), 0);
|
||||
ck_assert(strneq(sysname, "event", 5));
|
||||
|
||||
libinput_event_destroy(ev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ START_TEST(udev_device_sysname)
|
|||
ck_assert_notnull(sysname);
|
||||
ck_assert_int_gt(strlen(sysname), 1);
|
||||
ck_assert(strchr(sysname, '/') == NULL);
|
||||
ck_assert_int_eq(strncmp(sysname, "event", 5), 0);
|
||||
ck_assert(strneq(sysname, "event", 5));
|
||||
libinput_event_destroy(ev);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ find_device(const char *udev_tag)
|
|||
continue;
|
||||
|
||||
sysname = udev_device_get_sysname(device);
|
||||
if (strncmp("event", sysname, 5) != 0) {
|
||||
if (!strneq("event", sysname, 5)) {
|
||||
udev_device_unref(device);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue