]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: fix the way to print stat.st_size
authorMasatake YAMATO <yamato@redhat.com>
Thu, 10 Feb 2022 07:06:42 +0000 (16:06 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Thu, 10 Feb 2022 07:11:19 +0000 (16:11 +0900)
The format string was wrong and a proper cast operator was missed
for printing the member. See the example in stat(2).

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
misc-utils/lsfd-file.c

index 2507b3840491f9debfc8ad87ef79efddc5d37ab0..9c320e94935a7f1a6f896b7d4425ce5ae9c163b2 100644 (file)
@@ -289,7 +289,7 @@ static bool file_fill_column(struct proc *proc,
                xasprintf(&str, "%d", (int)file->stat.st_uid);
                break;
        case COL_SIZE:
-               xasprintf(&str, "%ju", file->stat.st_size);
+               xasprintf(&str, "%jd", (intmax_t)file->stat.st_size);
                break;
        case COL_NLINK:
                xasprintf(&str, "%ju", (unsigned long int)file->stat.st_nlink);