chiark / gitweb /
fix the fix and change the file to wait for to the "bus" link
[elogind.git] / udev.c
diff --git a/udev.c b/udev.c
index 3eb788f4c12ecfa08e32694e75dcec395c71f03c..36ff21d5b71c0ef231e325fb8ca4e728994b2bc4 100644 (file)
--- a/udev.c
+++ b/udev.c
@@ -109,7 +109,7 @@ int main(int argc, char *argv[], char *envp[])
                goto exit;
        }
 
-       /* export log_level , as called programs may want to do the same as udev */
+       /* export log_priority , as called programs may want to do the same as udev */
        if (udev_log_priority) {
                char priority[32];
 
@@ -179,34 +179,32 @@ int main(int argc, char *argv[], char *envp[])
                /* export name of device node or netif */
                if (udev.devname[0] != '\0')
                        setenv("DEVNAME", udev.devname, 1);
-       } else if (udev.type == DEV_DEVICE) {
-               if (strcmp(action, "add") == 0) {
-                       struct sysfs_device *devices_dev;
-
-                       /* wait for sysfs of /sys/devices/ */
-                       dbg("devices add");
-                       snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath);
-                       path[sizeof(path)-1] = '\0';
-                       devices_dev = wait_devices_device_open(path);
-                       if (!devices_dev) {
-                               dbg("devices device unavailable (probably remove has beaten us)");
-                               goto run;
-                       }
-                       dbg("devices device opened '%s'", path);
-                       wait_for_devices_device(devices_dev, &error);
-                       udev_rules_get_run(&udev, devices_dev);
-                       sysfs_close_device(devices_dev);
-                       if (udev.ignore_device) {
-                               info("device event will be ignored");
-                               goto cleanup;
-                       }
-               } else if (strcmp(action, "remove") == 0) {
-                       dbg("devices remove");
-                       udev_rules_get_run(&udev, NULL);
-                       if (udev.ignore_device) {
-                               info("device event will be ignored");
-                               goto cleanup;
-                       }
+       } else if (udev.type == DEV_DEVICE && strcmp(action, "add") == 0) {
+               struct sysfs_device *devices_dev;
+
+               /* wait for sysfs of /sys/devices/ */
+               dbg("devices add");
+               snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath);
+               path[sizeof(path)-1] = '\0';
+               devices_dev = wait_devices_device_open(path);
+               if (!devices_dev) {
+                       dbg("devices device unavailable (probably remove has beaten us)");
+                       goto run;
+               }
+               dbg("devices device opened '%s'", path);
+               wait_for_devices_device(devices_dev, &error);
+               udev_rules_get_run(&udev, devices_dev);
+               sysfs_close_device(devices_dev);
+               if (udev.ignore_device) {
+                       info("device event will be ignored");
+                       goto cleanup;
+               }
+       } else {
+               dbg("default handling");
+               udev_rules_get_run(&udev, NULL);
+               if (udev.ignore_device) {
+                       info("device event will be ignored");
+                       goto cleanup;
                }
        }