boot parameters: quoting of environment variables
PATCH 1/1 boot parameters: quoting of environment variables
The kernel currently allows boot parameters to be quoted (so that they can contain spaces) in the following way:
param="value"
Unfortunately, when init/main.c:unknown_bootoption reconstructs the parameter line for environment variables, it does not expect that there could be two \0s between the parameter name and its value. My patch corrects this by shifting the parameter name.
The patch is for 2.6.7, but also works with 2.6.8.1. Furthermore, I've checked that nothing relevant seems to have changed until 2.6.9-rc3.
- Werner
---------------------------------- cut here -----------------------------------
Signed-off-by Werner Almesberger <[email protected]>
init/main.c renamed from init/main.c.orig +7 -1
@@ -246,8 +246,14 @@static int __init unknown_bootoption (char *param,char *val) {/* Change NUL term back to "=", to make "param" the whole string. */ -if (val) +if (val) { val[-1 ] ='=' ; +/* If the value was quoted, shift the parameter name. */ +if (!val[-2 ]) { +memmove (param+1 ,param,strlen (param)); + param++; + } + }/* Handle obsolete-style parameters */ if (obsolete_checksetup (param))
Signature · 3 lines
_________________________________________________________________________ / Werner Almesberger, Buenos Aires, Argentina [email protected] / /_http://www.almesberger.net/____________________________________________/