* util/grub-editenv.c (argp_parser): Don't pass translated strings

as printf format strings; the translations might contain '%' which
could cause a crash.
(main): Likewise.
* util/grub-fstest.c (argp_parser): Likewise.
* util/grub-setup.c (argp_parser): Likewise.
(main): Likewise.
This commit is contained in:
Colin Watson 2010-09-20 17:56:14 +01:00
parent 3286a4b4c2
commit dfe3b247a2
4 changed files with 20 additions and 9 deletions

View file

@ -1,3 +1,13 @@
2010-09-20 Colin Watson <cjwatson@ubuntu.com>
* util/grub-editenv.c (argp_parser): Don't pass translated strings
as printf format strings; the translations might contain '%' which
could cause a crash.
(main): Likewise.
* util/grub-fstest.c (argp_parser): Likewise.
* util/grub-setup.c (argp_parser): Likewise.
(main): Likewise.
2010-09-20 Vladimir Serbinenko <phcoder@gmail.com> 2010-09-20 Vladimir Serbinenko <phcoder@gmail.com>
Use argp in grub-fstest. Use argp in grub-fstest.

View file

@ -72,7 +72,8 @@ error_t argp_parser (int key, char *arg, struct argp_state *state)
break; break;
case ARGP_KEY_NO_ARGS: case ARGP_KEY_NO_ARGS:
fprintf (stderr, _("You need to specify at least one command.\n")); fprintf (stderr, "%s",
_("You need to specify at least one command.\n"));
argp_usage (state); argp_usage (state);
break; break;
@ -272,7 +273,7 @@ main (int argc, char *argv[])
/* Parse our arguments */ /* Parse our arguments */
if (argp_parse (&argp, argc, argv, 0, &index, 0) != 0) if (argp_parse (&argp, argc, argv, 0, &index, 0) != 0)
{ {
fprintf (stderr, _("Error in parsing command line arguments\n")); fprintf (stderr, "%s", _("Error in parsing command line arguments\n"));
exit(1); exit(1);
} }

View file

@ -394,12 +394,12 @@ argp_parser (int key, char *arg, struct argp_state *state)
num_disks = grub_strtoul (arg, NULL, 0); num_disks = grub_strtoul (arg, NULL, 0);
if (num_disks < 1) if (num_disks < 1)
{ {
fprintf (stderr, _("Invalid disk count.\n")); fprintf (stderr, "%s", _("Invalid disk count.\n"));
argp_usage (state); argp_usage (state);
} }
if (args_count != 0) if (args_count != 0)
{ {
fprintf (stderr, _("Disk count must precede disks list.\n")); fprintf (stderr, "%s", _("Disk count must precede disks list.\n"));
argp_usage (state); argp_usage (state);
} }
return 0; return 0;
@ -415,12 +415,12 @@ argp_parser (int key, char *arg, struct argp_state *state)
case ARGP_KEY_END: case ARGP_KEY_END:
if (args_count < num_disks) if (args_count < num_disks)
{ {
fprintf (stderr, _("No command is specified.\n")); fprintf (stderr, "%s", _("No command is specified.\n"));
argp_usage (state); argp_usage (state);
} }
if (args_count - 1 - num_disks < nparm) if (args_count - 1 - num_disks < nparm)
{ {
fprintf (stderr, _("Not enough parameters to command.\n")); fprintf (stderr, "%s", _("Not enough parameters to command.\n"));
argp_usage (state); argp_usage (state);
} }
return 0; return 0;
@ -436,7 +436,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
{ {
if (arg[0] != '/') if (arg[0] != '/')
{ {
fprintf (stderr, _("Must use absolute path.\n")); fprintf (stderr, "%s", _("Must use absolute path.\n"));
argp_usage (state); argp_usage (state);
} }
if (args_count == 0) if (args_count == 0)

View file

@ -778,7 +778,7 @@ argp_parser (int key, char *arg, struct argp_state *state)
break; break;
case ARGP_KEY_NO_ARGS: case ARGP_KEY_NO_ARGS:
fprintf (stderr, _("No device is specified.\n")); fprintf (stderr, "%s", _("No device is specified.\n"));
argp_usage (state); argp_usage (state);
break; break;
@ -835,7 +835,7 @@ main (int argc, char *argv[])
/* Parse our arguments */ /* Parse our arguments */
if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0) if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
{ {
fprintf (stderr, _("Error in parsing command line arguments\n")); fprintf (stderr, "%s", _("Error in parsing command line arguments\n"));
exit(1); exit(1);
} }