summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 03:54:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-11 10:13:06 (GMT)
commit39c68542fc8d8477f2080c99efedb9dce975abc6 (patch)
tree20dc36a5228a41c4332ceed568254ab48d16c9df /builtin-pack-objects.c
parent141201d124f3663a98e0f362c1af7f5f7b58dabb (diff)
downloadgit-39c68542fc8d8477f2080c99efedb9dce975abc6.zip
git-39c68542fc8d8477f2080c99efedb9dce975abc6.tar.gz
git-39c68542fc8d8477f2080c99efedb9dce975abc6.tar.bz2
Wrap inflate and other zlib routines for better error reporting
R. Tyler Ballance reported a mysterious transient repository corruption; after much digging, it turns out that we were not catching and reporting memory allocation errors from some calls we make to zlib. This one _just_ wraps things; it doesn't do the "retry on low memory error" part, at least not yet. It is an independent issue from the reporting. Some of the errors are expected and passed back to the caller, but we die when zlib reports it failed to allocate memory for now. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index fb5e14d..85af80f 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -195,16 +195,16 @@ static int check_pack_inflate(struct packed_git *p,
int st;
memset(&stream, 0, sizeof(stream));
- inflateInit(&stream);
+ git_inflate_init(&stream);
do {
in = use_pack(p, w_curs, offset, &stream.avail_in);
stream.next_in = in;
stream.next_out = fakebuf;
stream.avail_out = sizeof(fakebuf);
- st = inflate(&stream, Z_FINISH);
+ st = git_inflate(&stream, Z_FINISH);
offset += stream.next_in - in;
} while (st == Z_OK || st == Z_BUF_ERROR);
- inflateEnd(&stream);
+ git_inflate_end(&stream);
return (st == Z_STREAM_END &&
stream.total_out == expect &&
stream.total_in == len) ? 0 : -1;