=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/compress/gzopen.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- src/usr.bin/compress/gzopen.c 2003/07/17 20:17:02 1.14 +++ src/usr.bin/compress/gzopen.c 2003/11/14 22:29:53 1.15 @@ -1,4 +1,4 @@ -/* $OpenBSD: gzopen.c,v 1.14 2003/07/17 20:17:02 mickey Exp $ */ +/* $OpenBSD: gzopen.c,v 1.15 2003/11/14 22:29:53 millert Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -59,7 +59,7 @@ */ const char gz_rcsid[] = - "$OpenBSD: gzopen.c,v 1.14 2003/07/17 20:17:02 mickey Exp $"; + "$OpenBSD: gzopen.c,v 1.15 2003/11/14 22:29:53 millert Exp $"; #include #include @@ -443,8 +443,22 @@ } s->z_crc = crc32(s->z_crc, start, (uInt)(s->z_stream.next_out - start)); + len -= s->z_stream.avail_out; - return (int)(len - s->z_stream.avail_out); + /* If at EOF, check for another appended file. */ + if (s->z_eof) { + int ocrc = s->z_crc; + s->z_crc = crc32(0L, Z_NULL, 0); + s->z_eof = 0; + if (get_header(s, NULL, 0) != 0 || + inflateEnd(&s->z_stream) != Z_OK || + inflateInit2(&s->z_stream, -MAX_WBITS) != Z_OK) { + s->z_eof = 1; + s->z_crc = ocrc; + } + } + + return (len); } int