[Libguestfs] [PATCH supermin] ext2: fix printf formatters

Pino Toscano ptoscano at redhat.com
Thu Apr 14 13:25:18 UTC 2016


Use the right formatting placeholders, so it gives no warnings also on
32bit platforms.
---
 src/ext2fs-c.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c
index e45980a..cb9282b 100644
--- a/src/ext2fs-c.c
+++ b/src/ext2fs-c.c
@@ -31,6 +31,7 @@
 #include <limits.h>
 #include <errno.h>
 #include <assert.h>
+#include <inttypes.h>
 
 /* Inlining is broken in the ext2fs header file.  Disable it by
  * defining the following:
@@ -659,9 +660,9 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest)
    */
   blocks = ROUND_UP (statbuf.st_size, data->fs->blocksize);
   if (blocks > ext2fs_free_blocks_count (data->fs->super)) {
-    fprintf (stderr, "supermin: %s: needed %lu blocks (%d each) for "
-                     "%lu bytes, available only %llu\n",
-             src, blocks, data->fs->blocksize, statbuf.st_size,
+    fprintf (stderr, "supermin: %s: needed %zu blocks (%d each) for "
+                     "%" PRIu64 " bytes, available only %llu\n",
+             src, blocks, data->fs->blocksize, (uint64_t) statbuf.st_size,
              ext2fs_free_blocks_count (data->fs->super));
     unix_error (ENOSPC, (char *) "block size",
                 data->fs->device_name ? caml_copy_string (data->fs->device_name) : Val_none);
-- 
2.5.5




More information about the Libguestfs mailing list