boot: pass in args as const
Copy the arg that sets a variable to maximize the reuse of this routine. There are places we call it from that are const char * and it might not be safe to cast that away. Sponsored by: Netflix
This commit is contained in:
parent
482380c6f8
commit
ed56dcfc6b
@ -125,7 +125,7 @@ boot_howto_to_env(int howto)
|
|||||||
* variable and set that instead.
|
* variable and set that instead.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
boot_parse_arg(char *v)
|
boot_parse_arg(const char *v)
|
||||||
{
|
{
|
||||||
char *n;
|
char *n;
|
||||||
int howto;
|
int howto;
|
||||||
@ -170,11 +170,16 @@ static int howto_masks[] = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
n = strsep(&v, "=");
|
char buf[128];
|
||||||
if (v == NULL)
|
char *vv = buf;
|
||||||
|
|
||||||
|
strlcpy(buf, v, sizeof(buf));
|
||||||
|
n = strsep(&vv, "=");
|
||||||
|
if (vv == NULL)
|
||||||
SETENV(n, "1");
|
SETENV(n, "1");
|
||||||
else
|
else
|
||||||
SETENV(n, v);
|
SETENV(n, vv);
|
||||||
|
free(vv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return (howto);
|
return (howto);
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
int boot_env_to_howto(void);
|
int boot_env_to_howto(void);
|
||||||
void boot_howto_to_env(int howto);
|
void boot_howto_to_env(int howto);
|
||||||
int boot_parse_arg(char *v);
|
int boot_parse_arg(const char *v);
|
||||||
int boot_parse_cmdline_delim(char *cmdline, const char *delim);
|
int boot_parse_cmdline_delim(char *cmdline, const char *delim);
|
||||||
int boot_parse_cmdline(char *cmdline);
|
int boot_parse_cmdline(char *cmdline);
|
||||||
int boot_parse_args(int argc, char *argv[]);
|
int boot_parse_args(int argc, char *argv[]);
|
||||||
|
Loading…
Reference in New Issue
Block a user