From 8e4bd225584b63478de106d7b306ba6707c8b2b4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Apr 2009 15:59:45 +0200 Subject: [PATCH] accept DEVNAME from the kernel as a hint for the node name --- udev/udev-event.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index f4d71217..b7cdbf34 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)); -- 2.39.5