linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH 1/3] cleanup: remove redundant code from callers of sysfs_get_attr_value()
Date: Thu, 04 Sep 2008 14:20:35 +0000	[thread overview]
Message-ID: <48BFEEB3.70909@tuffmail.co.uk> (raw)

* 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--;



             reply	other threads:[~2008-09-04 14:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-04 14:20 Alan Jenkins [this message]
2008-09-08 20:06 ` [PATCH 1/3] cleanup: remove redundant code from callers of sysfs_get_attr_value() Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48BFEEB3.70909@tuffmail.co.uk \
    --to=alan-jenkins@tuffmail.co.uk \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).