From 833a6c5a55c26b16ad6f9d99da26c0079ff8c077 Mon Sep 17 00:00:00 2001 From: Thomas Lindner Date: Sun, 12 Feb 2023 18:40:42 +0100 Subject: [PATCH] use proper format specifiers --- dump_inode.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dump_inode.c b/dump_inode.c index d195bfd..0a19a90 100644 --- a/dump_inode.c +++ b/dump_inode.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -77,7 +77,7 @@ int main(int argc, char **argv) { usage(); } mode |= MODE_INODE; - inode = strtonum(optarg, 2, UINT_MAX, &errstr); + inode = strtonum(optarg, 2, UINT32_MAX, &errstr); if (errstr) { errx(1, "Invalid inode %s: %s", optarg, errstr); } @@ -225,9 +225,10 @@ void dump_inode(ino_t inum, union dinode *dp) { default: type = 'u'; } - printf("inode:%llu type:%c mode:%o nlink:%u uid:%u gid:%u size:%llu " - "atime:%llu mtime:%llu ctime:%llu \n", - inum, type, DIP(dp, di_mode) & ~IFMT, DIP(dp, di_nlink), + printf("inode:%" PRIu32 " type:%c mode:%" PRIo16 " nlink:%" PRId16 + " uid:%" PRIu32 " gid:%" PRIu32 " size:%" PRIu64 " atime:%" PRId64 + " mtime:%" PRId64 " ctime:%" PRId64 "\n", + (uint32_t)inum, type, DIP(dp, di_mode) & ~IFMT, DIP(dp, di_nlink), DIP(dp, di_uid), DIP(dp, di_gid), DIP(dp, di_size), DIP(dp, di_atime), DIP(dp, di_mtime), DIP(dp, di_ctime)); } @@ -318,7 +319,7 @@ void dump_file_indirect(union dinode *dp, void *indirblock, int level, } } free(datablock); - fprintf(stderr, "\r%llu/%llu", DIP(dp, di_size) - *filesize, + fprintf(stderr, "\r%" PRIu64 "/%" PRIu64, DIP(dp, di_size) - *filesize, DIP(dp, di_size)); }