summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-04-28 15:59:45 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-04-28 15:59:45 +0200
commit8e4bd225584b63478de106d7b306ba6707c8b2b4 (patch)
tree63b2fd597fd52ad037db0e41cfbc42a62e3de60d
parent6d34b6af12144a89f2b41c2c2d7613706b34122a (diff)
accept DEVNAME from the kernel as a hint for the node name
-rw-r--r--udev/udev-event.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/udev/udev-event.c b/udev/udev-event.c
index f4d7121793..b7cdbf3402 100644
--- a/udev/udev-event.c
+++ b/udev/udev-event.c
@@ -579,12 +579,24 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
}
if (event->name == NULL) {
- info(event->udev, "no node name set, will use kernel name '%s'\n",
+ const char *devname;
+
+ devname = udev_device_get_property_value(event->dev, "DEVNAME");
+ if (devname != NULL) {
+ info(event->udev, "no node name set, will use "
+ "kernel supplied name '%s'\n", devname);
+ event->name = strdup(devname);
+ if (event->name == NULL)
+ goto exit_add;
+ }
+ }
+ if (event->name == NULL) {
+ info(event->udev, "no node name set, will use device name '%s'\n",
udev_device_get_sysname(event->dev));
event->name = strdup(udev_device_get_sysname(event->dev));
- if (event->name == NULL)
- goto exit_add;
}
+ if (event->name == NULL)
+ goto exit_add;
/* set device node name */
util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename));