chiark / gitweb /
let "ignore_device" always return the event successfully
authorKay Sievers <kay.sievers@suse.de>
Wed, 25 Jan 2006 01:21:07 +0000 (02:21 +0100)
committerKay Sievers <kay.sievers@suse.de>
Wed, 25 Jan 2006 01:21:07 +0000 (02:21 +0100)
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
udev.c
udev_device.c
udevd.c
udevstart.c

diff --git a/udev.c b/udev.c
index 6387d0b..17ab635 100644 (file)
--- a/udev.c
+++ b/udev.c
@@ -154,7 +154,7 @@ int main(int argc, char *argv[], char *envp[])
 
        retval = udev_device_event(&rules, udev);
 
-       if (!retval && udev_run && !list_empty(&udev->run_list)) {
+       if (retval == 0 && !udev->ignore_device && udev_run) {
                struct name_entry *name_loop;
 
                dbg("executing run list");
@@ -178,5 +178,7 @@ fail:
 
 exit:
        logging_close();
-       return retval;
+       if (retval != 0)
+               return 1;
+       return 0;
 }
index 781787e..5db2709 100644 (file)
@@ -88,14 +88,14 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev)
                udev_rules_get_name(rules, udev);
                if (udev->ignore_device) {
                        info("device event will be ignored");
-                       return -1;
+                       return 0;
                }
                /* create node, store in db */
                if (udev->name[0] != '\0')
                        retval = udev_add_device(udev);
                else
                        info("device node creation supressed");
-               return 0;
+               return retval;
        }
 
        if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) {
@@ -104,7 +104,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev)
                udev_rules_get_run(rules, udev);
                if (udev->ignore_device) {
                        info("device event will be ignored");
-                       return -1;
+                       return 0;
                }
                /* get data from db, remove db-entry, delete node */
                retval = udev_remove_device(udev);
@@ -112,15 +112,13 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev)
                /* restore stored persistent data */
                list_for_each_entry(name_loop, &udev->env_list, node)
                        putenv(name_loop->name);
-               return 0;
+               return retval;
        }
 
-       /* default devices */
+       /* default devices without a node */
        udev_rules_get_run(rules, udev);
-       if (udev->ignore_device) {
+       if (udev->ignore_device)
                info("device event will be ignored");
-               return -1;
-       }
 
        return retval;
 }
diff --git a/udevd.c b/udevd.c
index 4ed2f94..c94fdc7 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -117,9 +117,10 @@ static int udev_event_process(struct uevent_msg *msg)
        retval = udev_device_event(&rules, udev);
 
        /* run programs collected by RUN-key*/
-       if (retval == 0) {
+       if (retval == 0 && !udev->ignore_device && udev_run) {
                struct name_entry *name_loop;
 
+               dbg("executing run list");
                list_for_each_entry(name_loop, &udev->run_list, node) {
                        if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0)
                                pass_env_to_socket(&name_loop->name[strlen("socket:")], msg->devpath, msg->action);
index fdb2ae3..8f8342f 100644 (file)
@@ -108,6 +108,7 @@ static int add_device(const char *devpath)
 {
        struct sysfs_device *dev;
        struct udevice *udev;
+       int retval;
 
        /* clear and set environment for next event */
        clearenv();
@@ -146,14 +147,14 @@ static int add_device(const char *devpath)
                dbg("device event will be ignored");
                goto exit;
        }
-       if (udev->name[0] == '\0') {
-               dbg("device node creation supressed");
-               goto run;
+       if (udev->name[0] != '\0')
+               retval = udev_add_device(udev);
+       else {
+               info("device node creation supressed");
+               goto exit;
        }
 
-       udev_add_device(udev);
-run:
-       if (udev_run && !list_empty(&udev->run_list)) {
+       if (retval == 0 && !udev->ignore_device && udev_run) {
                struct name_entry *name_loop;
 
                dbg("executing run list");
@@ -169,9 +170,9 @@ run:
                        }
                }
        }
+
 exit:
        udev_device_cleanup(udev);
-
        return 0;
 }