]> err.no Git - systemd/commitdiff
use sysname() for devices without a device node
authorKay Sievers <kay.sievers@vrfy.org>
Tue, 24 Jan 2012 03:29:59 +0000 (04:29 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Tue, 24 Jan 2012 03:29:59 +0000 (04:29 +0100)
src/udev-event.c

index 0b6db30edad4f56d0a5471e0abe06a671a242d25..7ecaf85536e26d7f5bb2769001dbc76d629d8592 100644 (file)
@@ -349,12 +349,15 @@ subst:
                 case SUBST_NAME: {
                         if (event->name != NULL) {
                                 l = util_strpcpy(&s, l, event->name);
-                                dbg(event->udev, "substitute custom name '%s'\n", event->name);
-                        } else {
+                                dbg(event->udev, "substitute custom node name '%s'\n", event->name);
+                        } else if (udev_device_get_devnode(dev) != NULL) {
                                 size_t devlen = strlen(udev_get_dev_path(event->udev))+1;
 
                                 l = util_strpcpy(&s, l, &udev_device_get_devnode(dev)[devlen]);
-                                dbg(event->udev, "substitute name'%s'\n", &udev_device_get_devnode(dev)[devlen]);
+                                dbg(event->udev, "substitute node name'%s'\n", &udev_device_get_devnode(dev)[devlen]);
+                        } else {
+                                l = util_strpcpy(&s, l, udev_device_get_sysname(dev));
+                                dbg(event->udev, "substitute device name'%s'\n", udev_device_get_sysname(dev));
                         }
                         break;
                 }