diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2004-10-25 04:20:03 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-25 04:20:03 -0700 |
commit | a0f448ec6642c381dcc6d602c1e520322c167d32 (patch) | |
tree | 3f87c023a38d575be4fedc1b8eee3637d13ed736 /init | |
parent | 1857599ace885dfb946dbdcc9a754be40a3b9c3c (diff) | |
download | history-a0f448ec6642c381dcc6d602c1e520322c167d32.tar.gz |
[PATCH] boot parameters: quoting of environment variables revisited
As noticed by Joey Hess (and thanks for Christoph for forwarding it). Also
requirements from Werner Almesberger.
If someone passes 'foo="some value"' the param engine removes the quotes
and hands 'foo' and 'some value'. The __setup() parameters expect a single
string, and so we try to regenerate it from the two parts. Finally, we try
to place it as an environment variable.
Werner wants quotes stripped out of the environment variable. It makes
sense to do that for __setup, too (so it sees 'foo=some value'), since
__setup functions don't usually handle quotes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'init')
-rw-r--r-- | init/main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c index 72f596af21818f..91d6cbfa4ee775 100644 --- a/init/main.c +++ b/init/main.c @@ -287,8 +287,15 @@ static int __init unknown_bootoption(char *param, char *val) { /* Change NUL term back to "=", to make "param" the whole string. */ if (val) { - if (val[-1] == '"') val[-2] = '='; - else val[-1] = '='; + /* param=val or param="val"? */ + if (val == param+strlen(param)+1) + val[-1] = '='; + else if (val == param+strlen(param)+2) { + val[-2] = '='; + memmove(val-1, val, strlen(val)+1); + val--; + } else + BUG(); } /* Handle obsolete-style parameters */ |