chiark / gitweb /
[PATCH] klibc supports LOG_PID now, so remove our own implementation
[elogind.git] / udev.c
diff --git a/udev.c b/udev.c
index 4d25ed267a6442328f8af44b6d311246dfe0ab8b..0895e437ba76d6077c30ab5d685c7fca1be8bef7 100644 (file)
--- a/udev.c
+++ b/udev.c
@@ -41,7 +41,6 @@
 
 
 #ifdef LOG
-unsigned char logname[LOGNAME_SIZE];
 void log_message(int level, const char *format, ...)
 {
        va_list args;
@@ -118,6 +117,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;
@@ -128,14 +128,6 @@ int main(int argc, char *argv[], char *envp[])
        /* trigger timeout to prevent hanging processes */
        alarm(ALARM_TIMEOUT);
 
-       action = getenv("ACTION");
-       devpath = getenv("DEVPATH");
-       subsystem = getenv("SUBSYSTEM");
-       /* older kernels passed the SUBSYSTEM only as argument */
-       if (!subsystem && argc == 2)
-               subsystem = argv[1];
-       udev_init_device(&udev, devpath, subsystem);
-
        if (strstr(argv[0], "udevstart") || (argc == 2 && strstr(argv[1], "udevstart"))) {
                dbg("udevstart");
 
@@ -147,6 +139,14 @@ int main(int argc, char *argv[], char *envp[])
                goto exit;
        }
 
+       action = getenv("ACTION");
+       devpath = getenv("DEVPATH");
+       subsystem = getenv("SUBSYSTEM");
+       /* older kernels passed the SUBSYSTEM only as argument */
+       if (!subsystem && argc == 2)
+               subsystem = argv[1];
+       udev_init_device(&udev, devpath, subsystem);
+
        if (!action) {
                dbg("no action");
                goto hotplug;
@@ -209,9 +209,10 @@ int main(int argc, char *argv[], char *envp[])
                }
 
                /* run dev.d/ scripts if we created/deleted a node or changed a netif name */
-               if (udev_dev_d && udev.devname[0] != '\0') {
+               if (udev.devname[0] != '\0') {
                        setenv("DEVNAME", udev.devname, 1);
-                       udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX);
+                       if (udev_dev_d)
+                               udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX);
                }
        } else if ((strncmp(devpath, "/devices/", 9) == 0)) {
                if (strcmp(action, "add") == 0) {