chiark / gitweb /
[PATCH] export udev_log flag to the environment
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Tue, 23 Nov 2004 03:47:06 +0000 (04:47 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 05:35:00 +0000 (22:35 -0700)
Forked scripts and callouts may want to follow udev's configured behavior
and log only if udev is logging itself.

udev.c
udev_start.c

diff --git a/udev.c b/udev.c
index 78fe82cfbbc20c3ceacfe56eb8151516ba1c7201..39c16c2e77cc78133506955ec651e500838e7a77 100644 (file)
--- a/udev.c
+++ b/udev.c
@@ -81,6 +81,10 @@ int main(int argc, char *argv[], char *envp[])
        logging_init("udev");
        udev_init_config();
 
+       /* export logging flag, callouts may want to do the same as udev */
+       if (udev_log)
+               setenv("UDEV_LOG", "1", 1);
+
        if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) {
                act_type = UDEVSTART;
        } else {
@@ -143,7 +147,11 @@ int main(int argc, char *argv[], char *envp[])
        switch(act_type) {
        case UDEVSTART:
                dbg("udevstart");
+
+               /* disable all logging as it's much too slow on some facilities */
                udev_log = 0;
+               unsetenv("UDEV_LOG");
+
                namedev_init();
                retval = udev_start();
                break;
@@ -155,7 +163,7 @@ int main(int argc, char *argv[], char *envp[])
                class_dev = sysfs_open_class_device_path(path);
                if (class_dev == NULL) {
                        dbg ("sysfs_open_class_device_path failed");
-                       break;
+                       goto exit;
                }
                dbg("opened class_dev->name='%s'", class_dev->name);
 
index c1d877fb37dd42a85faff49f25ab931433fcbeb7..3e3062c0191c1cd97f535d6c66e75859a76e2870 100644 (file)
@@ -291,7 +291,7 @@ int udev_start(void)
 {
        /* set environment for callouts and dev.d/ */
        setenv("ACTION", "add", 1);
-       setenv("UDEVSTART", "1", 1);
+       setenv("UDEV_START", "1", 1);
 
        udev_scan_class();
        udev_scan_block();