From: Kay Sievers Date: Sun, 26 Oct 2008 01:48:14 +0000 (+0100) Subject: fix $attr{[/]} substitution X-Git-Tag: 174~1374 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=dc4c7e463df35776631150e4e18a4ba41749843c;hp=1822e9b033fcd91a7dfd3b0bfd12cfbbd93fc470 fix $attr{[/]} substitution --- 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)