From 2dd5415ff3a6817e90055b3a1e759b89c45b0232 Mon Sep 17 00:00:00 2001 From: delphij Date: Thu, 23 Sep 2010 01:24:33 +0000 Subject: In the past gunzip(1) write()'s after each inflate return. This is not optimal from a performance standpoint since the write buffer is not necessarily be filled up when the inflate rountine reached the end of input buffer and it's not the end of file. This problem gets uncovered by trying to pipe gunzip -c output to a GEOM device directly, which enforces the writes be multiple of sector size. Sponsored by: iXsystems, Inc. Reported by: jpaetzel MFC after: 2 weeks --- usr.bin/gzip/gzip.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'usr.bin/gzip') diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c index 4e16bf7..3f9bb4a 100644 --- a/usr.bin/gzip/gzip.c +++ b/usr.bin/gzip/gzip.c @@ -916,6 +916,8 @@ gz_uncompress(int in, int out, char *pre, size_t prelen, off_t *gsizep, switch (error) { /* Z_BUF_ERROR goes with Z_FINISH... */ case Z_BUF_ERROR: + if (z.avail_out > 0 && !done_reading) + continue; case Z_STREAM_END: case Z_OK: break; -- cgit v1.1