[comp.sources.bugs] ARC bomb on zero-length files + fix

bin@rhesus.primate.wisc.edu (Brain in Neutral) (07/19/88)

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);
  }
  
  /*

hyc@math.lsa.umich.edu (Howard Chu) (07/19/88)

Go ahead and install this fix, it's simple enough and the problem does
arise often enough to need it. Keep your original distribution handy,
though, because a lot of diffs are on the way. (Including these fixes.)
--
  /
 /_ , ,_.                      Howard Chu
/ /(_/(__                University of Michigan
    /           Computing Center          College of LS&A
   '              Unix Project          Information Systems