Skip to contentSkip to conversation

cleanup: remove redundant code from callers of sysfs_get_attr_value()

PATCH Applied Alan Jenkins 2 participants 2 messages Sep 4, 2008 – Sep 8, 2008

lore
Share & tools
lore
#0 lore raw

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
index 4719cab..f7acd9c 100644
@@ -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
index 738ffc6..9b75364 100644
@@ -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--;
Applied
#1 lore raw
Quoted 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