use proper format specifiers

This commit is contained in:
Thomas Lindner 2023-02-12 18:40:42 +01:00
parent 1325027567
commit 833a6c5a55

View file

@ -26,7 +26,7 @@
#include <err.h>
#include <fcntl.h>
#include <limits.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -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));
}