Date: Thu, 20 Jan 2022 06:28:10 GMT From: Wolfram Schneider <wosch@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: cfa3856452b6 - main - Use 64-bit integers for database statistics Message-ID: <202201200628.20K6SAPK096422@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=cfa3856452b6a52cfb8fef44c86da7488b81447d commit cfa3856452b6a52cfb8fef44c86da7488b81447d Author: Wolfram Schneider <wosch@FreeBSD.org> AuthorDate: 2022-01-19 20:34:33 +0000 Commit: Wolfram Schneider <wosch@FreeBSD.org> CommitDate: 2022-01-20 06:27:08 +0000 Use 64-bit integers for database statistics This fix (harmless) integer overflows for larger partitions (>2TB) PR: 223023 --- usr.bin/locate/locate/fastfind.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c index a4e12db970a3..081101fce96a 100644 --- a/usr.bin/locate/locate/fastfind.c +++ b/usr.bin/locate/locate/fastfind.c @@ -48,10 +48,10 @@ statistic (fp, path_fcodes) FILE *fp; /* open database */ char *path_fcodes; /* for error message */ { - register int lines, chars, size, big, zwerg; + long lines, chars, size, big, zwerg, umlaut; register u_char *p, *s; register int c; - int count, umlaut; + int count; u_char bigram1[NBG], bigram2[NBG], path[MAXPATHLEN]; for (c = 0, p = bigram1, s = bigram2; c < NBG; c++) { @@ -95,12 +95,12 @@ statistic (fp, path_fcodes) (void)printf("Bigram: %2.2f%%, ", (size - big) / (size / (float)100)); (void)printf("Total: %2.2f%%\n", (size - (2 * NBG)) / (chars / (float)100)); - (void)printf("Filenames: %d, ", lines); - (void)printf("Characters: %d, ", chars); - (void)printf("Database size: %d\n", size); - (void)printf("Bigram characters: %d, ", big); - (void)printf("Integers: %d, ", zwerg); - (void)printf("8-Bit characters: %d\n", umlaut); + (void)printf("Filenames: %ld, ", lines); + (void)printf("Characters: %ld, ", chars); + (void)printf("Database size: %ld\n", size); + (void)printf("Bigram characters: %ld, ", big); + (void)printf("Integers: %ld, ", zwerg); + (void)printf("8-Bit characters: %ld\n", umlaut); } #endif /* _LOCATE_STATISTIC_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202201200628.20K6SAPK096422>