From: kay.sievers@vrfy.org Date: Thu, 11 Mar 2004 09:39:53 +0000 (-0800) Subject: [PATCH] "symlink only" test X-Git-Tag: 022~15 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=0a5417a0ebe92f96fb103399c9aacdf39c719271;hp=558f80ba649fb5b8c2ac2a51e464f1aa07aa791d [PATCH] "symlink only" test Here is a test for the "symlink only" rule. Any reason to do the apply_format() inside the loop? I've changed it. --- diff --git a/namedev.c b/namedev.c index 7305676d4..025a14aea 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 7db92691d..c12a21ee3 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -511,6 +511,17 @@ EOF conf => < "SYMLINK only rule", + subsys => "block", + devpath => "block/sda", + expected => "symlink-only2", + conf => <