X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=namedev.c;h=1faa253c1e9b8685da16c5413d585b202383c8b0;hp=4e0476c6e3823335e60886c314205d815481c7d6;hb=83be97ba211c4f69e7fd9f16f57ca7210a116a7d;hpb=61219c756ad0ad622decaf81b92a558ba2a1bc59 diff --git a/namedev.c b/namedev.c index 4e0476c6e..1faa253c1 100644 --- a/namedev.c +++ b/namedev.c @@ -378,6 +378,7 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_attribute *tmpattr = NULL; struct config_device *dev; struct list_head *tmp; + char *c; list_for_each(tmp, &config_device_list) { dev = list_entry(tmp, struct config_device, node); @@ -406,10 +407,12 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, continue; label_found: - tmpattr->value[strlen(tmpattr->value)-1] = 0x00; + c = tmpattr->value + strlen(tmpattr->value)-1; + if (*c == '\n') + *c = 0x00; dbg("compare attribute '%s' value '%s' with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); - if (strcmp(dev->sysfs_value, tmpattr->value) != 0) + if (strcmp_pattern(dev->sysfs_value, tmpattr->value) != 0) continue; strfieldcpy(udev->name, dev->name); @@ -578,7 +581,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } } } - + if (sysfs_device) { dbg("sysfs_device->path='%s'", sysfs_device->path); dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); @@ -642,7 +645,7 @@ done: int namedev_init(void) { int retval; - + retval = namedev_init_rules(); if (retval) return retval;