linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marco d'Itri" <md@Linux.IT>
To: linux-hotplug@vger.kernel.org
Subject: udev 021 patches 1/2
Date: Thu, 04 Mar 2004 01:16:23 +0000	[thread overview]
Message-ID: <20040304011623.GC22285@wonderland.linux.it> (raw)

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

strip_trailing_blanks: makes comparisons on sysfs fields not sensitive to
trailing blanks (tested, it works for me).

-- 
ciao, |
Marco | [4888 seIurgyHK/uw2]

[-- Attachment #2: strip_trailing_blanks --]
[-- Type: text/plain, Size: 904 bytes --]

diff -ruNp udev-019.orig/namedev.c udev-019/namedev.c
--- udev-019.orig/namedev.c	2004-02-28 17:46:22.000000000 +0100
+++ udev-019/namedev.c	2004-02-28 17:46:17.000000000 +0100
@@ -520,6 +520,17 @@ attr_found:
 	return tmpattr;
 }
 
+static void strip_trailing_blanks(char *s)
+{
+	char *p;
+
+	for (p = s + strlen(s) - 1; p > s; p--) {
+		if (!isspace(*p))
+			break;
+		*p = '\0';
+	}
+}
+
 static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair)
 {
 	struct sysfs_attribute *tmpattr;
@@ -531,6 +542,8 @@ static int compare_sysfs_attribute(struc
 	if (tmpattr == NULL)
 		return -ENODEV;
 
+	strip_trailing_blanks(tmpattr->value);
+	strip_trailing_blanks(pair->value);
 	dbg("compare attribute '%s' value '%s' with '%s'",
 		  pair->file, tmpattr->value, pair->value);
 	if (strcmp_pattern(pair->value, tmpattr->value) != 0)

             reply	other threads:[~2004-03-04  1:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-04  1:16 Marco d'Itri [this message]
2004-03-04 19:11 ` udev 021 patches 1/2 Greg KH

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=20040304011623.GC22285@wonderland.linux.it \
    --to=md@linux.it \
    --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).