]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fallocate: Use correct formatters and casts
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 18 Apr 2026 16:02:28 +0000 (18:02 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sat, 18 Apr 2026 16:02:28 +0000 (18:02 +0200)
The loff_t data type is signed, so use %jd and intmax_t for highest
portability.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
sys-utils/fallocate.c

index bb056b7ad9b42d312942191d4f13224a28cadc43..a3ff3f612ae74529b216f02fa66ef0bba70fac9c 100644 (file)
@@ -498,23 +498,23 @@ int main(int argc, char **argv)
                        char *str = size_to_human_string(SIZE_SUFFIX_3LETTER | SIZE_SUFFIX_SPACE, length);
 
                        if (mode & FALLOC_FL_PUNCH_HOLE)
-                               fprintf(stdout, _("%s: %s (%ju bytes) hole created.\n"),
-                                                               filename, str, length);
+                               fprintf(stdout, _("%s: %s (%jd bytes) hole created.\n"),
+                                                               filename, str, (intmax_t) length);
                        else if (mode & FALLOC_FL_COLLAPSE_RANGE)
-                               fprintf(stdout, _("%s: %s (%ju bytes) removed.\n"),
-                                                               filename, str, length);
+                               fprintf(stdout, _("%s: %s (%jd bytes) removed.\n"),
+                                                               filename, str, (intmax_t) length);
                        else if (mode & FALLOC_FL_INSERT_RANGE)
-                               fprintf(stdout, _("%s: %s (%ju bytes) inserted.\n"),
-                                                               filename, str, length);
+                               fprintf(stdout, _("%s: %s (%jd bytes) inserted.\n"),
+                                                               filename, str, (intmax_t) length);
                        else if (mode & FALLOC_FL_ZERO_RANGE)
-                               fprintf(stdout, _("%s: %s (%ju bytes) zeroed.\n"),
-                                                               filename, str, length);
+                               fprintf(stdout, _("%s: %s (%jd bytes) zeroed.\n"),
+                                                               filename, str, (intmax_t) length);
                        else if (mode & FALLOC_FL_WRITE_ZEROES)
-                               fprintf(stdout, _("%s: %s (%ju bytes) written as zeroes.\n"),
-                                                               filename, str, length);
+                               fprintf(stdout, _("%s: %s (%jd bytes) written as zeroes.\n"),
+                                                               filename, str, (intmax_t) length);
                        else
-                               fprintf(stdout, _("%s: %s (%ju bytes) allocated.\n"),
-                                                               filename, str, length);
+                               fprintf(stdout, _("%s: %s (%jd bytes) allocated.\n"),
+                                                               filename, str, (intmax_t) length);
                        free(str);
                }
        }