summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--namedev.c15
-rw-r--r--test/udev-test.pl11
2 files changed, 16 insertions, 10 deletions
diff --git a/namedev.c b/namedev.c
index 7305676d42..025a14aea4 100644
--- a/namedev.c
+++ b/namedev.c
@@ -815,16 +815,11 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud
}
if (dev->symlink[0] != '\0') {
- char temp[NAME_MAX];
-
info("configured rule in '%s' at line %i applied, added symlink '%s'",
dev->config_file, dev->config_line, dev->symlink);
- /* do not clobber dev */
- strfieldcpy(temp, dev->symlink);
- apply_format(udev, temp, sizeof(temp),
- class_dev, sysfs_device);
- strfieldcat(udev->symlink, temp);
- strfieldcat(udev->symlink, " ");
+ if (udev->symlink[0] != '\0')
+ strfieldcat(udev->symlink, " ");
+ strfieldcat(udev->symlink, dev->symlink);
}
if (dev->name[0] != '\0') {
@@ -841,8 +836,8 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud
goto done;
found:
- apply_format(udev, udev->name, sizeof(udev->name),
- class_dev, sysfs_device);
+ apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device);
+ apply_format(udev, udev->symlink, sizeof(udev->symlink), class_dev, sysfs_device);
udev->partitions = dev->partitions;
done:
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 7db92691d3..c12a21ee3d 100644
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -513,6 +513,17 @@ BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE ", NAME="wrong-to-ignore"
BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE ", NAME="matched-with-space"
EOF
},
+ {
+ desc => "SYMLINK only rule",
+ subsys => "block",
+ devpath => "block/sda",
+ expected => "symlink-only2",
+ conf => <<EOF
+BUS="scsi", KERNEL="sda", SYMLINK="symlink-only1"
+BUS="scsi", KERNEL="sda", SYMLINK="symlink-only2"
+BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="symlink0"
+EOF
+ },
);
# set env