[Libguestfs] [PATCH 2/2] rescue: fix sscanf placeholders for --smp and --memsize
Richard W.M. Jones
rjones at redhat.com
Fri Aug 8 10:18:22 UTC 2014
On Fri, Aug 08, 2014 at 11:29:25AM +0200, Pino Toscano wrote:
> Use %d to parse them as int (since the variables for them as int)
> instead of %u, even if they both need to be at least > 0; the library
> will check for the validity of them anyway.
> ---
> rescue/rescue.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/rescue/rescue.c b/rescue/rescue.c
> index dc56d4b..c73db55 100644
> --- a/rescue/rescue.c
> +++ b/rescue/rescue.c
> @@ -157,7 +157,7 @@ main (int argc, char *argv[])
> else
> format = optarg;
> } else if (STREQ (long_options[option_index].name, "smp")) {
> - if (sscanf (optarg, "%u", &smp) != 1) {
> + if (sscanf (optarg, "%d", &smp) != 1) {
> fprintf (stderr, _("%s: could not parse --smp parameter '%s'\n"),
> program_name, optarg);
> exit (EXIT_FAILURE);
> @@ -208,7 +208,7 @@ main (int argc, char *argv[])
> break;
>
> case 'm':
> - if (sscanf (optarg, "%u", &memsize) != 1) {
> + if (sscanf (optarg, "%d", &memsize) != 1) {
> fprintf (stderr, _("%s: could not parse memory size '%s'\n"),
> program_name, optarg);
> exit (EXIT_FAILURE);
ACK.
Thanks, Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
More information about the Libguestfs
mailing list