delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/12/08/11:50:02

From: "Juan Manuel Guerrero" <ST001906 AT HRZ1 DOT HRZ DOT TU-Darmstadt DOT De>
Organization: Darmstadt University of Technology
To: djgpp-workers AT delorie DOT com
Date: Fri, 8 Dec 2000 17:49:17 +0200
MIME-Version: 1.0
Subject: Small bugfix for djtar
X-mailer: Pegasus Mail for Windows (v2.54DE)
Message-ID: <D813594DE7@HRZ1.hrz.tu-darmstadt.de>
Reply-To: djgpp-workers AT delorie DOT com

If djtar is invoked as:
  djtar -x *.zip
it will unzip the first zip file it founds and
for all others it will issue the error message:
  foo.zip: invalid zip file structure

Except for the first zip file, djtar is not able to unzip them.
Please note that there must be really **more** than one zip file
in the cwd for this bug to be triggered.
The reason is that the counters and buffers that are used, are not
reinitialized to zero as they should. This has not been noticed
because all this variables are global, so they are intialized to zero
at program start but later they retain their old *and* wrong values
makeing the second and later calls of epunzip_read() fail.
The patch below will fix this bug. This patch will *not* interfere
with the bzip-support patch.

Regards,
Guerrero, Juan Manuel.

diff -acprNC5 djgpp.orig/src/utils/djtar/epunzip.c djgpp/src/utils/djtar/epunzip.c
*** djgpp.orig/src/utils/djtar/epunzip.c	Tue Nov 28 21:04:06 2000
--- djgpp/src/utils/djtar/epunzip.c	Fri Dec  8 17:21:50 2000
*************** static char *changed_name = NULL;
*** 33,42 ****
--- 33,43 ----
  int epcopy(char *, long);
  
  void
  epunzip_read(char *zipfilename)
  {
+   clear_bufs();
    errno = 0;
    ifd = oread_open(zipfilename);
    if(errno)
      {
        fprintf(log_out, "%s: %s\n", zipfilename, strerror(errno));

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019