]> err.no Git - systemd/commitdiff
libudev: monitor - handle kernel supplied DEVNAME properly
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 3 Jul 2009 16:40:38 +0000 (18:40 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Sat, 4 Jul 2009 02:12:06 +0000 (04:12 +0200)
libudev/Makefile.am
libudev/libudev-device.c
libudev/libudev-monitor.c

index cae12b1043a1a4bc3e2f26364b6b6ce91306bcae..b50eac9628c3b44ffb20b891090f2306de1b32c7 100644 (file)
@@ -29,7 +29,7 @@ libudev_la_SOURCES =\
        libudev-queue.c
 
 LT_CURRENT=4
-LT_REVISION=0
+LT_REVISION=1
 LT_AGE=4
 libudev_la_LDFLAGS = \
        -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
index 7644e6c63d26ad192b704665d2b835268f03b127..cbbddaeff044c6df548bdb1c42cf61f113a69126 100644 (file)
@@ -1299,6 +1299,7 @@ int udev_device_set_knodename(struct udev_device *udev_device, const char *knode
        udev_device->knodename = strdup(knodename);
        if (udev_device->knodename == NULL)
                return -ENOMEM;
+       udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename);
        return 0;
 }
 
index e8cdd30a166e2357b1969241263b462ae4ce24e8..2c6c685c6b9aa8f25417849a1f2622c71d5d98e0 100644 (file)
@@ -504,7 +504,6 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
        int action_set = 0;
        int maj = 0;
        int min = 0;
-       int is_kernel = 0;
 
 retry:
        if (udev_monitor == NULL)
@@ -545,10 +544,10 @@ retry:
                        }
                } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) {
                        if (snl.nl_pid > 0) {
-                               info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", snl.nl_pid);
+                               info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n",
+                                    snl.nl_pid);
                                return NULL;
                        }
-                       is_kernel = 1;
                }
        }
 
@@ -590,9 +589,8 @@ retry:
        }
 
        udev_device = udev_device_new(udev_monitor->udev);
-       if (udev_device == NULL) {
+       if (udev_device == NULL)
                return NULL;
-       }
 
        while (bufpos < buflen) {
                char *key;
@@ -616,10 +614,10 @@ retry:
                } else if (strncmp(key, "DEVTYPE=", 8) == 0) {
                        udev_device_set_devtype(udev_device, &key[8]);
                } else if (strncmp(key, "DEVNAME=", 8) == 0) {
-                       if (is_kernel)
-                               udev_device_set_knodename(udev_device, &key[8]);
-                       else
+                       if (key[8] == '/')
                                udev_device_set_devnode(udev_device, &key[8]);
+                       else
+                               udev_device_set_knodename(udev_device, &key[8]);
                } else if (strncmp(key, "DEVLINKS=", 9) == 0) {
                        char devlinks[UTIL_PATH_SIZE];
                        char *slink;