summaryrefslogtreecommitdiff
path: root/misc/dumpe2fs.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2021-02-11 10:55:21 -0500
committerTheodore Ts'o <tytso@mit.edu>2021-02-11 10:55:21 -0500
commit33b9a60c366da5df92d9c1b003aedaf1d0e2008a (patch)
treeaade9700c6078483cb10e400114ceb889c29f666 /misc/dumpe2fs.c
parentfb874e6ff42bee3ee327afc2651483b83311b445 (diff)
downloade2fsprogs-33b9a60c366da5df92d9c1b003aedaf1d0e2008a.tar.gz
Fix clang warnings on architectures with a 64-bit long
On most systems where we compile e2fsprogs, the u64 type is an unsigned long long. However, there are platforms (such as the PowerPC) where a long 64-bits and so u64 is typedef'ed to be unsigned long instead of a unsigned long long. Fix this by using explicit casts in printf statements. For scanf calls, we need to receive the value into a unsigned long long, and then assign it to a u64, after doing range checks. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc/dumpe2fs.c')
-rw-r--r--misc/dumpe2fs.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 4ea1ac85..3f4fc4ed 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -196,9 +196,9 @@ static void list_desc(ext2_filsys fs, int grp_only)
&old_desc_blk, &new_desc_blk, 0);
if (grp_only) {
- printf("%lu:%llu:", i, first_block);
+ printf("%lu:%llu:", i, (unsigned long long) first_block);
if (i == 0 || super_blk)
- printf("%llu:", super_blk);
+ printf("%llu:", (unsigned long long) super_blk);
else
printf("-1:");
if (old_desc_blk) {
@@ -206,13 +206,13 @@ static void list_desc(ext2_filsys fs, int grp_only)
old_desc_blk + old_desc_blocks - 1);
printf(":");
} else if (new_desc_blk)
- printf("%llu:", new_desc_blk);
+ printf("%llu:", (unsigned long long) new_desc_blk);
else
printf("-1:");
printf("%llu:%llu:%llu\n",
- ext2fs_block_bitmap_loc(fs, i),
- ext2fs_inode_bitmap_loc(fs, i),
- ext2fs_inode_table_loc(fs, i));
+ (unsigned long long) ext2fs_block_bitmap_loc(fs, i),
+ (unsigned long long) ext2fs_inode_bitmap_loc(fs, i),
+ (unsigned long long) ext2fs_inode_table_loc(fs, i));
continue;
}
@@ -485,7 +485,8 @@ static void print_mmp_block(ext2_filsys fs)
if (retval) {
com_err(program_name, retval,
_("reading MMP block %llu from '%s'\n"),
- fs->super->s_mmp_block, fs->device_name);
+ (unsigned long long) fs->super->s_mmp_block,
+ fs->device_name);
return;
}
@@ -496,7 +497,8 @@ static void print_mmp_block(ext2_filsys fs)
printf(" mmp_check_interval: %d\n", mmp->mmp_check_interval);
printf(" mmp_sequence: %#08x\n", mmp->mmp_seq);
printf(" mmp_update_date: %s", ctime(&mmp_time));
- printf(" mmp_update_time: %lld\n", mmp->mmp_time);
+ printf(" mmp_update_time: %llu\n",
+ (unsigned long long) mmp->mmp_time);
printf(" mmp_node_name: %.*s\n",
EXT2_LEN_STR(mmp->mmp_nodename));
printf(" mmp_device_name: %.*s\n",