[PATCH 1/3] cleanup: remove redundant code from callers of sysfs_get_attr_value()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* duplicate strlcpy in udev_rules_apply_format()

* "remove trailing newlines" in udevinfo, when sysfs_attr_get_value()
  does that already.

diff --git a/udev/udev_rules.c b/udev/udev_rules.c
index 4719cab..f7acd9c 100644
--- a/udev/udev_rules.c
+++ b/udev/udev_rules.c
@@ -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);
 				}
diff --git a/udev/udevinfo.c b/udev/udevinfo.c
index 738ffc6..9b75364 100644
--- a/udev/udevinfo.c
+++ b/udev/udevinfo.c
@@ -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--;


--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux