summaryrefslogtreecommitdiff
path: root/builtin/count-objects.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-10-15 22:40:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-16 17:10:41 (GMT)
commitcac05d4dfd148071462939a61ecd44cf932a0b02 (patch)
tree278f7256254da08af94c6339803771c749abb278 /builtin/count-objects.c
parent0d3b729680e9cab0f567122e796dab2bc9bc8cfb (diff)
downloadgit-cac05d4dfd148071462939a61ecd44cf932a0b02.zip
git-cac05d4dfd148071462939a61ecd44cf932a0b02.tar.gz
git-cac05d4dfd148071462939a61ecd44cf932a0b02.tar.bz2
count-objects: do not use xsize_t when counting object size
The point of xsize_t is to safely cast an off_t into a size_t (because we are about to mmap). But in count-objects, we are summing the sizes in an off_t. Using xsize_t means that count-objects could fail on a 32-bit system with a 4G object (not likely, as other parts of git would fail, but we should at least be correct here). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/count-objects.c')
-rw-r--r--builtin/count-objects.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index a7f70cb..316a805 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -53,7 +53,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
if (lstat(path, &st) || !S_ISREG(st.st_mode))
bad = 1;
else
- (*loose_size) += xsize_t(on_disk_bytes(st));
+ (*loose_size) += on_disk_bytes(st);
}
if (bad) {
if (verbose) {