From 39c68542fc8d8477f2080c99efedb9dce975abc6 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 7 Jan 2009 19:54:47 -0800 Subject: 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 --- builtin-unpack-objects.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'builtin-unpack-objects.c') diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c index 40b20f26e..41d00d36c 100644 --- a/builtin-unpack-objects.c +++ b/builtin-unpack-objects.c @@ -99,10 +99,10 @@ static void *get_data(unsigned long size) stream.avail_out = size; stream.next_in = fill(1); stream.avail_in = len; - inflateInit(&stream); + git_inflate_init(&stream); for (;;) { - int ret = inflate(&stream, 0); + int ret = git_inflate(&stream, 0); use(len - stream.avail_in); if (stream.total_out == size && ret == Z_STREAM_END) break; @@ -118,7 +118,7 @@ static void *get_data(unsigned long size) stream.next_in = fill(1); stream.avail_in = len; } - inflateEnd(&stream); + git_inflate_end(&stream); return buf; } -- cgit v1.2.1