summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2012-01-24 04:29:59 +0100
committerKay Sievers <kay.sievers@vrfy.org>2012-01-24 04:29:59 +0100
commite605cf7782fdf1dc2e13b95e906e731d61e6cf12 (patch)
treecea26df319583d203e0df0c0de8d8a0cd94c8600
parente483478115bce95af6feb2a6174f8308f3f02b7d (diff)
use sysname() for devices without a device node
-rw-r--r--src/udev-event.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/udev-event.c b/src/udev-event.c
index 0b6db30eda..7ecaf85536 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;
}