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