X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_rules.c;h=d42b219d7d4697bedac9032e81167700c778a707;hb=d47fd445bd9ade720776f661a4ad7c4b2202d6f0;hp=6a485f08afaa00bf5eabf1701726ecc510c68609;hpb=e8d569b4145a358775e87058829133fa725b32fd;p=elogind.git diff --git a/udev_rules.c b/udev_rules.c index 6a485f08a..d42b219d7 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -187,7 +187,8 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu if (bufline[0] == COMMENT_CHARACTER) continue; - strlcpy(line, bufline, count+1); + memcpy(line, bufline, count); + line[count] = '\0'; linepos = line; if (get_key(&linepos, &variable, &value) == 0) { @@ -295,6 +296,7 @@ static int find_free_number(struct udevice *udev, const char *name) static int find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, const char *name, char *value, size_t len) { + struct sysfs_class_device *class_dev_parent; struct sysfs_attribute *tmpattr; dbg("look for device attribute '%s'", name); @@ -303,6 +305,12 @@ static int find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sys tmpattr = sysfs_get_classdev_attr(class_dev, name); if (tmpattr) goto attr_found; + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent) { + tmpattr = sysfs_get_classdev_attr(class_dev_parent, name); + if (tmpattr) + goto attr_found; + } } if (sysfs_device) { dbg("look for devices attribute '%s/%s'", sysfs_device->path, name);