aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfram Schneider <wosch@FreeBSD.org>2022-01-19 20:34:33 +0000
committerWolfram Schneider <wosch@FreeBSD.org>2022-01-20 06:27:08 +0000
commitcfa3856452b6a52cfb8fef44c86da7488b81447d (patch)
tree09f39ce40b3413f87c73839419b181f10753edbd
parent7406ec4ea99c1c61e88d5c98c58094093b9e78fb (diff)
downloadsrc-cfa3856452b6a52cfb8fef44c86da7488b81447d.tar.gz
src-cfa3856452b6a52cfb8fef44c86da7488b81447d.zip
Use 64-bit integers for database statistics
This fix (harmless) integer overflows for larger partitions (>2TB) PR: 223023
-rw-r--r--usr.bin/locate/locate/fastfind.c16
1 files 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_ */