git: 1f2c178e5688 - main - find: Use formats that work on 32-bit too...
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 26 Jul 2025 05:02:41 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=1f2c178e5688cac21d61ce240a736652ddf02265
commit 1f2c178e5688cac21d61ce240a736652ddf02265
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-07-26 04:58:49 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-07-26 05:02:31 +0000
find: Use formats that work on 32-bit too...
Sponsored by: Netflix
---
usr.bin/find/printf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/usr.bin/find/printf.c b/usr.bin/find/printf.c
index 6ca018d58f34..671d1d1dbb9a 100644
--- a/usr.bin/find/printf.c
+++ b/usr.bin/find/printf.c
@@ -230,13 +230,13 @@ do_printf(PLAN *plan, FTSENT *entry, FILE *fout)
break;
}
case 'k': /* kbytes used by file */
- fprintf(fp, "%ld", sb->st_blocks / 2);
+ fprintf(fp, "%jd", (intmax_t)sb->st_blocks / 2);
break;
case 'b': /* blocks used by file */
- fprintf(fp, "%ld", sb->st_blocks);
+ fprintf(fp, "%jd", (intmax_t)sb->st_blocks);
break;
case 's': /* size in bytes of file */
- fprintf(fp, "%zu", sb->st_size);
+ fprintf(fp, "%ju", (uintmax_t)sb->st_size);
break;
case 'S': /* sparseness of file */
fprintf(fp, "%3.1f",
@@ -246,7 +246,7 @@ do_printf(PLAN *plan, FTSENT *entry, FILE *fout)
fprintf(fp, "%ld", entry->fts_level);
break;
case 'D': /* device number */
- fprintf(fp, "%lu", sb->st_dev);
+ fprintf(fp, "%ju", (uintmax_t)sb->st_dev);
break;
case 'F': /* Filesystem type */
errx(1, "%%%c is unimplemented", c);
@@ -254,10 +254,10 @@ do_printf(PLAN *plan, FTSENT *entry, FILE *fout)
fprintf(fp, "%s", entry->fts_accpath);
break;
case 'i': /* inode # */
- fprintf(fp, "%lu", sb->st_ino);
+ fprintf(fp, "%ju", (uintmax_t)sb->st_ino);
break;
case 'n': /* number of hard links */
- fprintf(fp, "%lu", sb->st_nlink);
+ fprintf(fp, "%ju", (uintmax_t)sb->st_nlink);
break;
case 'y': /* -type of file, incl 'l' */
errx(1, "%%%c is unimplemented", c);