Commit 08ccfcc1 authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

[PATCH] handle quoted module parameters

Fix module parameter quote handling.
Module parameter strings (with spaces) are quoted like so:
"modprm=this test"
and not like this:
modprm="this test"
Signed-off-by: default avatarRandy Dunlap <rddunlap@osdl.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8c42b547
...@@ -77,10 +77,16 @@ static int parse_one(char *param, ...@@ -77,10 +77,16 @@ static int parse_one(char *param,
static char *next_arg(char *args, char **param, char **val) static char *next_arg(char *args, char **param, char **val)
{ {
unsigned int i, equals = 0; unsigned int i, equals = 0;
int in_quote = 0; int in_quote = 0, quoted = 0;
char *next;
/* Chew any extra spaces */ /* Chew any extra spaces */
while (*args == ' ') args++; while (*args == ' ') args++;
if (*args == '"') {
args++;
in_quote = 1;
quoted = 1;
}
for (i = 0; args[i]; i++) { for (i = 0; args[i]; i++) {
if (args[i] == ' ' && !in_quote) if (args[i] == ' ' && !in_quote)
...@@ -106,13 +112,16 @@ static char *next_arg(char *args, char **param, char **val) ...@@ -106,13 +112,16 @@ static char *next_arg(char *args, char **param, char **val)
if (args[i-1] == '"') if (args[i-1] == '"')
args[i-1] = '\0'; args[i-1] = '\0';
} }
if (quoted && args[i-1] == '"')
args[i-1] = '\0';
} }
if (args[i]) { if (args[i]) {
args[i] = '\0'; args[i] = '\0';
return args + i + 1; next = args + i + 1;
} else } else
return args + i; next = args + i;
return next;
} }
/* Args looks like "foo=bar,bar2 baz=fuz wiz". */ /* Args looks like "foo=bar,bar2 baz=fuz wiz". */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment