fix grub-script-check
This commit is contained in:
parent
63533ab093
commit
275d6f6bd4
2 changed files with 14 additions and 10 deletions
|
@ -112,7 +112,7 @@ struct grub_script_cmd_menuentry
|
|||
struct grub_script_arglist *arglist;
|
||||
|
||||
/* The sourcecode the entry will be generated from. */
|
||||
char *sourcecode;
|
||||
const char *sourcecode;
|
||||
|
||||
/* Options. XXX: Not used yet. */
|
||||
int options;
|
||||
|
|
|
@ -82,16 +82,8 @@ grub_script_execute_cmdif (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
|||
}
|
||||
|
||||
grub_err_t
|
||||
grub_script_execute_menuentry (struct grub_script_cmd *cmd)
|
||||
grub_script_execute_menuentry (struct grub_script_cmd *cmd __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_script_cmd_menuentry *menu;
|
||||
menu = (struct grub_script_cmd_menuentry *)cmd;
|
||||
|
||||
if (menu->sourcecode)
|
||||
{
|
||||
grub_free (menu->sourcecode);
|
||||
menu->sourcecode = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -146,6 +138,7 @@ main (int argc, char *argv[])
|
|||
auto grub_err_t get_config_line (char **line, int cont);
|
||||
grub_err_t get_config_line (char **line, int cont __attribute__ ((unused)))
|
||||
{
|
||||
int i;
|
||||
char *cmdline = 0;
|
||||
size_t len = 0;
|
||||
ssize_t read;
|
||||
|
@ -164,6 +157,17 @@ main (int argc, char *argv[])
|
|||
if (verbose)
|
||||
grub_printf("%s", cmdline);
|
||||
|
||||
for (i = 0; cmdline[i] != '\0'; i++)
|
||||
{
|
||||
/* Replace tabs and carriage returns with spaces. */
|
||||
if (cmdline[i] == '\t' || cmdline[i] == '\r')
|
||||
cmdline[i] = ' ';
|
||||
|
||||
/* Replace '\n' with '\0'. */
|
||||
if (cmdline[i] == '\n')
|
||||
cmdline[i] = '\0';
|
||||
}
|
||||
|
||||
*line = grub_strdup (cmdline);
|
||||
|
||||
free (cmdline);
|
||||
|
|
Loading…
Reference in a new issue