[Libguestfs] [PATCH 2/2] rescue: fix sscanf placeholders for --smp and --memsize

Pino Toscano ptoscano at redhat.com
Fri Aug 8 09:29:25 UTC 2014


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);
-- 
1.9.3




More information about the Libguestfs mailing list