From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Marco d'Itri" Date: Wed, 03 Mar 2004 01:16:24 +0000 Subject: Re: [ANNOUNCE] udev 021 release Message-Id: <20040303011624.GA15729@wonderland.linux.it> MIME-Version: 1 Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" List-Id: References: <20040303000957.GA11755@kroah.com> In-Reply-To: <20040303000957.GA11755@kroah.com> To: linux-hotplug@vger.kernel.org --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mar 03, Greg KH wrote: >different distros were using. If there's anything missing from udev, or >any patches that I've missed, please let me and the people at the >linux-hotplug-devel mailing list know about it. What about the patches sent by multiple people to strip trailing blanks from sysfs attributes? I still think it would be an useful feature. I'm attaching a patch, untested. -- ciao, | Marco | [4868 caP3CkN9lIBa2] --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=strip_trailing_blanks 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 const *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) --M9NhX3UHpAaciwkO-- ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&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