chiark / gitweb /
[PATCH] don't call dev.d/ scripts twice, if directory = subsystem
[elogind.git] / udev.c
diff --git a/udev.c b/udev.c
index efeb1b505073f3f258c86b2d2ced20592bf1d394..5ad7e425e6fc212433148a52b16489aca28afc4d 100644 (file)
--- a/udev.c
+++ b/udev.c
@@ -33,7 +33,7 @@
 
 #include "libsysfs/sysfs/libsysfs.h"
 #include "udev.h"
-#include "udev_lib.h"
+#include "udev_utils.h"
 #include "udev_sysfs.h"
 #include "udev_version.h"
 #include "namedev.h"
@@ -108,6 +108,7 @@ int main(int argc, char *argv[], char *envp[])
        udev_init_config();
 
        /* set signal handlers */
+       memset(&act, 0x00, sizeof(act));
        act.sa_handler = (void (*) (int))sig_handler;
        sigemptyset (&act.sa_mask);
        act.sa_flags = 0;
@@ -179,9 +180,9 @@ int main(int argc, char *argv[], char *envp[])
                        retval = udev_add_device(&udev, class_dev);
 
                        /* run dev.d/ scripts if we created a node or changed a netif name */
-                       if (udev.devname[0] != '\0') {
+                       if (udev_dev_d && udev.devname[0] != '\0') {
                                setenv("DEVNAME", udev.devname, 1);
-                               dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX);
+                               udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX);
                        }
 
                        sysfs_close_class_device(class_dev);
@@ -197,9 +198,9 @@ int main(int argc, char *argv[], char *envp[])
                                setenv("DEVNAME", udev.devname, 1);
                        }
                        /* run dev.d/ scripts if we're not instructed to ignore the event */
-                       if (udev.devname[0] != '\0') {
+                       if (udev_dev_d && udev.devname[0] != '\0') {
                                setenv("DEVNAME", udev.devname, 1);
-                               dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX);
+                               udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX);
                        }
 
                }
@@ -228,7 +229,7 @@ int main(int argc, char *argv[], char *envp[])
 
 hotplug:
        if (manage_hotplug_event())
-               dev_d_execute(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX);
+               udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX);
 
 exit:
        logging_close();