linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udev 021 patches 1/2
@ 2004-03-04  1:16 Marco d'Itri
  2004-03-04 19:11 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Marco d'Itri @ 2004-03-04  1:16 UTC (permalink / raw)
  To: linux-hotplug

[-- 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: udev 021 patches 1/2
  2004-03-04  1:16 udev 021 patches 1/2 Marco d'Itri
@ 2004-03-04 19:11 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-03-04 19:11 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Mar 04, 2004 at 02:16:23AM +0100, Marco d'Itri wrote:
> strip_trailing_blanks: makes comparisons on sysfs fields not sensitive to
> trailing blanks (tested, it works for me).

I've taken Kay's patch for this instead, as it will work for both
situations (wanting to test for trailing spaces, and not wanting to.)

thanks,

greg k-h


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-04 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-04  1:16 udev 021 patches 1/2 Marco d'Itri
2004-03-04 19:11 ` Greg KH

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).