tools/helpers: fix snprintf argument in init-dom0less.c
authorLuca Fancellu <luca.fancellu@arm.com>
Tue, 5 Jul 2022 11:11:25 +0000 (13:11 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 5 Jul 2022 11:11:25 +0000 (13:11 +0200)
Fix snprintf argument in init-dom0less.c because two instances of
the function are using libxl_dominfo struct members that are uint64_t
types, so change "%lu" to "%"PRIu64 to handle it properly when
building on arm32 and arm64.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
tools/helpers/init-dom0less.c

index 4c90dd6a0c8f5901fdd76b6e7a31917090a4bfb2..fee93459c4b9da59446a2f8dfcf5cbfc4d95aeab 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdlib.h>
 #include <sys/mman.h>
 #include <sys/time.h>
+#include <inttypes.h>
 #include <xenstore.h>
 #include <xenctrl.h>
 #include <xenguest.h>
@@ -138,10 +139,10 @@ static int create_xenstore(struct xs_handle *xsh,
                   "vm/" LIBXL_UUID_FMT, LIBXL_UUID_BYTES(uuid));
     if (rc < 0 || rc >= STR_MAX_LENGTH)
         return rc;
-    rc = snprintf(max_memkb_str, STR_MAX_LENGTH, "%lu", info->max_memkb);
+    rc = snprintf(max_memkb_str, STR_MAX_LENGTH, "%"PRIu64, info->max_memkb);
     if (rc < 0 || rc >= STR_MAX_LENGTH)
         return rc;
-    rc = snprintf(target_memkb_str, STR_MAX_LENGTH, "%lu", info->current_memkb);
+    rc = snprintf(target_memkb_str, STR_MAX_LENGTH, "%"PRIu64, info->current_memkb);
     if (rc < 0 || rc >= STR_MAX_LENGTH)
         return rc;
     rc = snprintf(ring_ref_str, STR_MAX_LENGTH, "%lld",