struct udev_device *udev_device;
struct libinput_device *device;
+ if (strlen(path) > PATH_MAX) {
+ log_bug_client(libinput,
+ "Unexpected path, limited to %d characters.\n",
+ PATH_MAX);
+ return NULL;
+ }
+
if (libinput->interface_backend != &interface_backend) {
log_bug_client(libinput, "Mismatching backends.\n");
return NULL;
}
END_TEST
+START_TEST(path_create_pathmax_file)
+{
+ struct libinput *li;
+ struct libinput_device *device;
+ char *path;
+ struct counter counter;
+
+ path = zalloc(PATH_MAX * 2);
+ memset(path, 'a', PATH_MAX * 2 - 1);
+
+ counter.open_func_count = 0;
+ counter.close_func_count = 0;
+
+ li = libinput_path_create_context(&counting_interface, &counter);
+
+ litest_set_log_handler_bug(li);
+ ck_assert(li != NULL);
+ device = libinput_path_add_device(li, path);
+ ck_assert(device == NULL);
+
+ ck_assert_int_eq(counter.open_func_count, 0);
+ ck_assert_int_eq(counter.close_func_count, 0);
+
+ litest_restore_log_handler(li);
+ libinput_unref(li);
+ ck_assert_int_eq(counter.close_func_count, 0);
+
+ free(path);
+}
+END_TEST
+
+
START_TEST(path_create_destroy)
{
struct libinput *li;
litest_add_no_device("path:create", path_create_invalid);
litest_add_no_device("path:create", path_create_invalid_file);
litest_add_no_device("path:create", path_create_invalid_kerneldev);
+ litest_add_no_device("path:create", path_create_pathmax_file);
litest_add_no_device("path:create", path_create_destroy);
litest_add("path:create", path_force_destroy, LITEST_ANY, LITEST_ANY);
litest_add_no_device("path:create", path_set_user_data);