linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH, UDEV] change no_trailing_slash() to remove all trailing slashes
@ 2005-02-05 17:18 Michael Buesch
  2005-02-05 18:15 ` [PATCH, UDEV] change no_trailing_slash() to remove all Kay Sievers
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Michael Buesch @ 2005-02-05 17:18 UTC (permalink / raw)
  To: linux-hotplug


[-- Attachment #1.1: Type: text/plain, Size: 262 bytes --]

Hi,

This changes no_trailing_slash() to remove all trailing slashes
and not just the last one.
This protects against crazy users which do:
export SYSFS_PATH="/sys//"
or something similiar.

-- 
Regards Michael Buesch  [ http://www.tuxsoft.de.vu ]



[-- Attachment #1.2: udev_no_trailing_slash.diff --]
[-- Type: text/x-diff, Size: 414 bytes --]

===== udev_utils.c 1.25 vs edited =====
--- 1.25/udev_utils.c	2004-12-20 22:10:57 +01:00
+++ edited/udev_utils.c	2005-02-05 18:13:46 +01:00
@@ -200,11 +200,11 @@
 
 void no_trailing_slash(char *path)
 {
-	int len;
+	size_t len;
 
 	len = strlen(path);
-	if (len > 0 && path[len-1] == '/')
-		path[len-1] = '\0';
+	while (len > 0 && path[len-1] == '/')
+		path[--len] = '\0';
 }
 
 struct files {

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2005-02-06  9:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-05 17:18 [PATCH, UDEV] change no_trailing_slash() to remove all trailing slashes Michael Buesch
2005-02-05 18:15 ` [PATCH, UDEV] change no_trailing_slash() to remove all Kay Sievers
2005-02-05 22:04 ` [PATCH, UDEV] change no_trailing_slash() to remove all trailing Paul Jackson
2005-02-05 22:36 ` [PATCH, UDEV] change no_trailing_slash() to remove all trailing slashes Michael Buesch
2005-02-06  1:11 ` [PATCH, UDEV] change no_trailing_slash() to remove all trailing Paul Jackson
2005-02-06  9:54 ` [PATCH, UDEV] change no_trailing_slash() to remove all trailing slashes Michael Buesch

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