chiark / gitweb /
[PATCH] add ACTION to udev object to expose it to the whole process
[elogind.git] / udevtest.c
index f2b0c98edb2dd35a720c2960bbdd775c1a468098..e67af0df673fb05dd3378afb056f95f79f7dd697 100644 (file)
@@ -103,15 +103,17 @@ int main(int argc, char *argv[], char *envp[])
                subsystem = argv[2];
 
        /* fill in values and test_run flag*/
-       udev_set_values(&udev, devpath, subsystem);
+       udev_set_values(&udev, devpath, subsystem, "add");
 
        /* open the device */
        snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath);
        class_dev = sysfs_open_class_device_path(path);
-       if (class_dev == NULL)
-               dbg ("sysfs_open_class_device_path failed");
-       else
-               dbg("opened class_dev->name='%s'", class_dev->name);
+       if (class_dev == NULL) {
+               info("sysfs_open_class_device_path failed");
+               return 1;
+       }
+
+       dbg("opened class_dev->name='%s'", class_dev->name);
 
        /* simulate node creation with test flag */
        udev.test_run = 1;