NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
re: bin/41793: gzip fails to decompress multiple logical bzip2 streams created pbzip2
this fixes the problem.
.mrg.
Index: unbzip2.c
===================================================================
RCS file: /cvsroot/src/usr.bin/gzip/unbzip2.c,v
retrieving revision 1.11
diff -p -r1.11 unbzip2.c
*** unbzip2.c 28 Apr 2008 20:24:13 -0000 1.11
--- unbzip2.c 28 Jul 2009 17:29:21 -0000
*************** unbzip2(int in, int out, char *pre, size
*** 62,68 ****
if (bytes_in)
*bytes_in = prelen;
! while (ret >= BZ_OK && ret != BZ_STREAM_END) {
if (bzs.avail_in == 0 && !end_of_file) {
ssize_t n;
--- 62,68 ----
if (bytes_in)
*bytes_in = prelen;
! while (ret == BZ_OK) {
if (bzs.avail_in == 0 && !end_of_file) {
ssize_t n;
*************** unbzip2(int in, int out, char *pre, size
*** 86,92 ****
case BZ_OK:
if (ret == BZ_OK && end_of_file)
maybe_err("read");
! if (!tflag) {
ssize_t n;
n = write(out, outbuf, BUFLEN - bzs.avail_out);
--- 86,92 ----
case BZ_OK:
if (ret == BZ_OK && end_of_file)
maybe_err("read");
! if (!tflag && bzs.avail_out != BUFLEN) {
ssize_t n;
n = write(out, outbuf, BUFLEN - bzs.avail_out);
*************** unbzip2(int in, int out, char *pre, size
*** 94,100 ****
maybe_err("write");
bytes_out += n;
}
! break;
case BZ_DATA_ERROR:
maybe_warnx("bzip2 data integrity error");
--- 94,106 ----
maybe_err("write");
bytes_out += n;
}
! if (ret == BZ_STREAM_END && !end_of_file) {
! if (BZ2_bzDecompressEnd(&bzs) != BZ_OK ||
! BZ2_bzDecompressInit(&bzs, 0, 0) != BZ_OK)
! maybe_errx("bzip2 re-init");
! ret = BZ_OK;
! }
! break;
case BZ_DATA_ERROR:
maybe_warnx("bzip2 data integrity error");
*************** unbzip2(int in, int out, char *pre, size
*** 107,113 ****
case BZ_MEM_ERROR:
maybe_warnx("bzip2 out of memory");
break;
!
}
}
--- 113,122 ----
case BZ_MEM_ERROR:
maybe_warnx("bzip2 out of memory");
break;
!
! default:
! maybe_warnx("unknown bzip2 error: %d", ret);
! break;
}
}
Home |
Main Index |
Thread Index |
Old Index