ARC bomb on zero-length files + fix

Brain in Neutral bin at rhesus.primate.wisc.edu
Tue Jul 19 06:14:00 AEST 1988


ARC bombs after archiving a zero-length file; it tries to print
the percentage compression, calculated of course as:

	compressed-size/original-size

or something like that.  The result is a floating exception.
The patch below fixes it.


*** arcpack.c~	Mon Jul 18 14:38:27 1988
--- arcpack.c	Mon Jul 18 14:39:45 1988
***************
*** 155,161
  	/* standard cleanups common to all methods */
  
  	if (note)
! 		printf("done. (%ld%%)\n",100L - (100L*hdr->size)/hdr->length);
  }
  
  /*

--- 155,162 -----
  	/* standard cleanups common to all methods */
  
  	if (note)
! 		printf("done. (%ld%%)\n",hdr->length == 0 ?
! 				0L : 100L - (100L*hdr->size)/hdr->length);
  }
  
  /*



More information about the Comp.sources.bugs mailing list