* util/grub-script-check.c (main): Ensure defined behaviour on empty

input files (in which case exit zero).
This commit is contained in:
Colin Watson 2010-05-27 15:54:18 +01:00
parent db2102a046
commit d870813427
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
* util/grub-script-check.c (main): Ensure defined behaviour on empty
input files (in which case exit zero).
2010-05-27 Colin Watson <cjwatson@ubuntu.com> 2010-05-27 Colin Watson <cjwatson@ubuntu.com>
* kern/emu/misc.c (canonicalize_file_name): realpath can still * kern/emu/misc.c (canonicalize_file_name): realpath can still

View file

@ -145,7 +145,8 @@ main (int argc, char *argv[])
char *input; char *input;
FILE *file = 0; FILE *file = 0;
int verbose = 0; int verbose = 0;
struct grub_script *script; int found_input = 0;
struct grub_script *script = NULL;
auto grub_err_t get_config_line (char **line, int cont); auto grub_err_t get_config_line (char **line, int cont);
grub_err_t get_config_line (char **line, int cont __attribute__ ((unused))) grub_err_t get_config_line (char **line, int cont __attribute__ ((unused)))
@ -247,6 +248,7 @@ main (int argc, char *argv[])
get_config_line(&input, 0); get_config_line(&input, 0);
if (! input) if (! input)
break; break;
found_input = 1;
script = grub_script_parse (input, get_config_line); script = grub_script_parse (input, get_config_line);
if (script) if (script)
@ -262,5 +264,5 @@ main (int argc, char *argv[])
grub_fini_all (); grub_fini_all ();
if (file) fclose (file); if (file) fclose (file);
return (script == 0); return (found_input && script == 0);
} }