From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Jenkins Date: Thu, 04 Sep 2008 14:20:35 +0000 Subject: [PATCH 1/3] cleanup: remove redundant code from callers of sysfs_get_attr_value() Message-Id: <48BFEEB3.70909@tuffmail.co.uk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org * 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--;