From: Kay Sievers Date: Tue, 24 Jan 2012 03:29:59 +0000 (+0100) Subject: use sysname() for devices without a device node X-Git-Tag: 179~2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e605cf7782fdf1dc2e13b95e906e731d61e6cf12;p=systemd use sysname() for devices without a device node --- diff --git a/src/udev-event.c b/src/udev-event.c index 0b6db30e..7ecaf855 100644 --- a/src/udev-event.c +++ b/src/udev-event.c @@ -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; }