lkml.org 
[lkml]   [2008]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] kobject: Replace ALL occurrences of '/' with '!' instead of only the first one.
Date
From: Ingo Oeser <ioe-lkml@rameria.de>

A recent patch from Kay Sievers <kay.sievers@vrfy.org>
replaced the first occurrence of '/' with '!' as needed for block devices.

Now do some cheap defensive coding and replace all of them to avoid future
issues in this area.

Signed-off-by: Ingo Oeser <ioe-lkml@rameria.de>
---
To answer your questions:
> Do you know of block devices with more than one?

No, just defensive coding :-)

> Nice, care to send a follow-on patch for this?

Linus just pulled, so I generated it against his latest tree.


lib/kobject.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/lib/kobject.c b/lib/kobject.c
index 7444015..ce2cf43 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -224,8 +224,7 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
return -ENOMEM;

/* ewww... some of these buggers have '/' in the name ... */
- s = strchr(kobj->name, '/');
- if (s)
+ while (s = strchr(kobj->name, '/'))
s[0] = '!';

kfree(old_name);
--
1.5.4.3


\
 
 \ /
  Last update: 2008-07-23 01:39    [from the cache]
©2003-2011 Jasper Spaans