]> err.no Git - systemd/commitdiff
[PATCH] prevent udevd crash if DEVPATH is not set
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Fri, 19 Nov 2004 02:49:13 +0000 (03:49 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 05:30:27 +0000 (22:30 -0700)
Just move the event straight to the exec list and don't try
to compare a NULL pointer.

udevd.c

diff --git a/udevd.c b/udevd.c
index 43f3f0324b79cdf309c1be3939042a0dbce4c78d..dd505d03d95d2538111ad26cfc379b49560c01a3 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -153,9 +153,14 @@ static void udev_run(struct hotplug_msg *msg)
 static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg)
 {
        struct hotplug_msg *loop_msg;
-       list_for_each_entry(loop_msg, &running_list, list)
-               if (strncmp(loop_msg->devpath, msg->devpath, sizeof(loop_msg->devpath)) == 0)
+       list_for_each_entry(loop_msg, &running_list, list) {
+               if (loop_msg->devpath == NULL || msg->devpath == NULL)
+                       continue;
+
+               if (strcmp(loop_msg->devpath, msg->devpath) == 0)
                        return loop_msg;
+       }
+
        return NULL;
 }