cleanup: remove redundant code from callers of sysfs_get_attr_value()
PATCH 1/3 cleanup: remove redundant code from callers of sysfs_get_attr_value()
* duplicate strlcpy in udev_rules_apply_format()
* "remove trailing newlines" in udevinfo, when sysfs_attr_get_value() does that already.
udev/udev_rules.c +1 -3
@@ -850,10 +850,8 @@ found:do {dbg ("looking at '%s'\n" , dev_parent->devpath); value =sysfs_attr_get_value (dev_parent->devpath, attr); -if (value !=NULL ) { -strlcpy (temp2, value,sizeof (temp2)); +if (value !=NULL )break ; - } dev_parent =sysfs_device_get_parent (dev_parent); }while (dev_parent !=NULL ); }
udev/udevinfo.c +0 -4
@@ -75,10 +75,6 @@ static void print_all_attributes(const char *devpath, const char *key) len =sizeof (value) -1 ;dbg ("attr '%s'='%s'(%zi)\n" , dent->d_name, value, len); -/* remove trailing newlines */ -while (len && value[len-1 ] ='\n' ) - value[--len] ='\0' ; -/* skip nonprintable attributes */ while (len &&isprint (value[len-1 ])) len--;
Kay Sievers
AppliedQuoted 4 lines · Alan Jenkins
* duplicate strlcpy in
udev_rules_apply_format()* "remove trailing newlines" in udevinfo, when
sysfs_attr_get_value()does that already.
Applied.
Thanks,
Kay