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.
|
||||
*/
|
||||
int
|
||||
boot_parse_arg(char *v)
|
||||
boot_parse_arg(const char *v)
|
||||
{
|
||||
char *n;
|
||||
int howto;
|
||||
@ -170,11 +170,16 @@ static int howto_masks[] = {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
n = strsep(&v, "=");
|
||||
if (v == NULL)
|
||||
char buf[128];
|
||||
char *vv = buf;
|
||||
|
||||
strlcpy(buf, v, sizeof(buf));
|
||||
n = strsep(&vv, "=");
|
||||
if (vv == NULL)
|
||||
SETENV(n, "1");
|
||||
else
|
||||
SETENV(n, v);
|
||||
SETENV(n, vv);
|
||||
free(vv);
|
||||
}
|
||||
#endif
|
||||
return (howto);
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
int boot_env_to_howto(void);
|
||||
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(char *cmdline);
|
||||
int boot_parse_args(int argc, char *argv[]);
|
||||
|
Loading…
Reference in New Issue
Block a user