Subject: Re: gunzip|dd causes dd to fail w/ new gzip
To: Noriyuki Soda <soda@sra.co.jp>
From: enami tsugutomo <enami@sm.sony.co.jp>
List: tech-userlevel
Date: 07/09/2004 20:19:51
Noriyuki Soda <soda@sra.co.jp> writes:

> BTW, since many people don't actually know what "dd=" means,

You need to implement the new option first!

enami.

Index: gzip.c
===================================================================
RCS file: /cvsroot/src/usr.bin/gzip/gzip.c,v
retrieving revision 1.51
diff -c -r1.51 gzip.c
*** gzip.c	3 Jul 2004 09:39:30 -0000	1.51
--- gzip.c	9 Jul 2004 11:19:01 -0000
***************
*** 751,757 ****
  		case GZSTATE_READ:
  			error = inflate(&z, Z_FINISH);
  			/* Z_BUF_ERROR goes with Z_FINISH... */
! 			if (error == Z_STREAM_END || error == Z_BUF_ERROR) {
  				size_t wr = BUFLEN - z.avail_out;
  
  				/* Nothing left? */
--- 751,760 ----
  		case GZSTATE_READ:
  			error = inflate(&z, Z_FINISH);
  			/* Z_BUF_ERROR goes with Z_FINISH... */
! 			if (error == Z_STREAM_END ||
! 			    (error == Z_BUF_ERROR &&
! 			    /* output buffer is filled or EOF encountered */
! 			    (z.avail_out == 0 || done_reading))) {
  				size_t wr = BUFLEN - z.avail_out;
  
  				/* Nothing left? */
***************
*** 780,787 ****
  
  				break;
  			}
! 			if (error < 0) {
! 				maybe_warnx("decompression error");
  				out_tot = -1;
  				goto stop;
  			}
--- 783,790 ----
  
  				break;
  			}
! 			if (error < 0 && error != Z_BUF_ERROR) {
! 				maybe_warnx("decompression error (%d)", error);
  				out_tot = -1;
  				goto stop;
  			}