Skip to contentSkip to conversation

{PATCH] e2fsprogs: fix printf format in print_blocks_proc()

PATCH Eric Sandeen 1 participant 1 message May 29, 2014

lore
Share & tools
lore
#0 lore raw

blockcnt is of type e2_blkcnt_t, which is:

typedef __s64 __bitwise e2_blkcnt_t;

so use %lld not %d to print it.

---

lib/ext2fs/tst_libext2fs.c +1 -1
index 1f63eb7..b4fb7f2 100644
@@ -37,7 +37,7 @@ static int print_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
 			     blk64_t ref_block, int ref_offset,
 			     void *private EXT2FS_ATTR((unused)))
 {
-	printf("%6d %8llu (%d %llu)\n", blockcnt, *blocknr,
+	printf("%6lld %8llu (%d %llu)\n", (long long)blockcnt, *blocknr,
 	       ref_offset, ref_block);
 	return 0;
 }