From dc4c7e463df35776631150e4e18a4ba41749843c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Oct 2008 02:48:14 +0100 Subject: [PATCH] fix $attr{[/]} substitution --- test/udev-test.pl | 10 ++++++++++ udev/udev-event.c | 12 ++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index f630b74a9..767f6adeb 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1654,6 +1654,16 @@ EOF rules => < "magic [subsys/sysname] attribute substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda-8741C4G-end", + exp_perms => "0:0:0660", + rules => <udev, attr, value, sizeof(value), 1); - val = udev_device_get_sysattr_value(event->dev, attr); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); + /* try to read attribute of the current device */ + if (value[0] == '\0') { + val = udev_device_get_sysattr_value(event->dev, attr); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + } - /* try the current device, other matches may have selected */ + /* try to read the attribute of the parent device, other matches have selected */ if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { val = udev_device_get_sysattr_value(event->dev_parent, attr); if (val != NULL) -- 2.30.2