From 0cb543d77989c2c6680645a4002336966cf37562 Mon Sep 17 00:00:00 2001 From: Ivana Varekova Date: Feb 08 2008 14:10:35 +0000 Subject: - fix output when out of space error appears --- diff --git a/unzip-5.52-249057.patch b/unzip-5.52-249057.patch new file mode 100644 index 0000000..d18583b --- /dev/null +++ b/unzip-5.52-249057.patch @@ -0,0 +1,163 @@ +diff -up unzip-5.52/unzpriv.h.err unzip-5.52/unzpriv.h +--- unzip-5.52/unzpriv.h.err 2008-02-08 14:51:52.000000000 +0100 ++++ unzip-5.52/unzpriv.h 2008-02-08 14:51:52.000000000 +0100 +@@ -2182,7 +2182,7 @@ char *GetLoadPath OF((__GPRO)); + int SetFileSize OF((FILE *file, ulg filesize)); /* local */ + #endif + #ifndef MTS /* macro in MTS */ +- void close_outfile OF((__GPRO)); /* local */ ++ int close_outfile OF((__GPRO)); /* local */ + #endif + #ifdef SET_SYMLINK_ATTRIBS + int set_symlnk_attribs OF((__GPRO__ slinkentry *slnk_entry)); /* local */ +diff -up unzip-5.52/unix/unix.c.err unzip-5.52/unix/unix.c +--- unzip-5.52/unix/unix.c.err 2008-02-08 14:51:52.000000000 +0100 ++++ unzip-5.52/unix/unix.c 2008-02-08 15:04:15.000000000 +0100 +@@ -1029,10 +1029,41 @@ static int get_extattribs(__G__ pzt, z_u + #ifndef MTS + + /****************************/ ++/* Function CloseError() */ ++/***************************/ ++ ++int CloseError(__G) ++ __GDEF ++{ ++ int errval = PK_OK; ++ ++ if (fclose(G.outfile) < 0) { ++ switch (errno) { ++ case ENOSPC: ++ /* Do we need this on fileio.c? */ ++ Info(slide, 0x4a1, ((char *)slide, "%s: write error (disk full?). Continue? (y/n/^C) ", ++ FnFilter1(G.filename))); ++ fgets(G.answerbuf, 9, stdin); ++ if (*G.answerbuf == 'y') /* stop writing to this file */ ++ G.disk_full = 1; /* pass to next */ ++ else ++ G.disk_full = 2; /* no: exit program */ ++ ++ errval = PK_DISK; ++ break; ++ ++ default: ++ errval = PK_WARN; ++ } ++ } ++ return errval; ++} /* End of CloseError() */ ++ ++/****************************/ + /* Function close_outfile() */ + /****************************/ + +-void close_outfile(__G) /* GRR: change to return PK-style warning level */ ++int close_outfile(__G) + __GDEF + { + union { +@@ -1041,6 +1072,7 @@ void close_outfile(__G) /* GRR: chang + } zt; + ush z_uidgid[2]; + int have_uidgid_flg; ++ int errval = PK_OK; + + fchmod(fileno(G.outfile), 0400); + +@@ -1054,7 +1086,14 @@ void close_outfile(__G) /* GRR: chang + perror("chmod (file attributes) error"); + #endif + +- fclose(G.outfile); ++/*--------------------------------------------------------------------------- ++ Check what fclose() reports from the device, this is always safer. ++ An NFS non Solaris could be full and we could be facing ENOSPC not ++ seen by write() without opening with O_SYNC or writing with fsync(). ++ - jmp. ++ ---------------------------------------------------------------------------*/ ++ ++ errval = CloseError(G.outfile, G.filename); + + /*--------------------------------------------------------------------------- + If symbolic links are supported, allocate storage for a symlink control +@@ -1075,14 +1114,14 @@ void close_outfile(__G) /* GRR: chang + Info(slide, 0x201, ((char *)slide, + "warning: symbolic link (%s) failed: mem alloc overflow\n", + FnFilter1(G.filename))); +- return; ++ return PK_WARN; + } + + if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) { + Info(slide, 0x201, ((char *)slide, + "warning: symbolic link (%s) failed: no mem\n", + FnFilter1(G.filename))); +- return; ++ return PK_WARN; + } + slnk_entry->next = NULL; + slnk_entry->targetlen = ucsize; +@@ -1102,12 +1141,12 @@ void close_outfile(__G) /* GRR: chang + FnFilter1(G.filename))); + free(slnk_entry); + if (G.outfile) +- fclose(G.outfile); +- return; ++ errval = CloseError(G.outfile, G.filename); ++ return errval; + } + + if (G.outfile) +- fclose(G.outfile); /* close "link" file for good... */ ++ errval = CloseError(G.outfile, G.filename); /* close "lnk" file for good*/ + slnk_entry->target[ucsize] = '\0'; + if (QCOND2) + Info(slide, 0, ((char *)slide, "-> %s ", +@@ -1118,7 +1157,7 @@ void close_outfile(__G) /* GRR: chang + else + G.slink_head = slnk_entry; + G.slink_last = slnk_entry; +- return; ++ return errval; + } + #endif /* SYMLINKS */ + +@@ -1166,6 +1205,7 @@ void close_outfile(__G) /* GRR: chang + #endif /* ?AOS_VS */ + } + ++ return errval; + } /* end function close_outfile() */ + + #endif /* !MTS */ +diff -up unzip-5.52/extract.c.err unzip-5.52/extract.c +--- unzip-5.52/extract.c.err 2008-02-08 14:51:52.000000000 +0100 ++++ unzip-5.52/extract.c 2008-02-08 14:51:52.000000000 +0100 +@@ -1676,24 +1676,21 @@ static int extract_or_test_member(__G) + + #ifdef VMS /* VMS: required even for stdout! (final flush) */ + if (!uO.tflag) /* don't close NULL file */ +- close_outfile(__G); ++ error = close_outfile(__G); + #else + #ifdef DLL + if (!uO.tflag && (!uO.cflag || G.redirect_data)) { + if (G.redirect_data) + FINISH_REDIRECT(); + else +- close_outfile(__G); ++ error = close_outfile(__G); + } + #else + if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */ +- close_outfile(__G); ++ error = close_outfile(__G); + #endif + #endif /* VMS */ + +- /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */ +- +- + if (G.disk_full) { /* set by flush() */ + if (G.disk_full > 1) { + #if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK)) diff --git a/unzip.spec b/unzip.spec index 4f9a9b2..916a776 100644 --- a/unzip.spec +++ b/unzip.spec @@ -1,7 +1,7 @@ Summary: A utility for unpacking zip files Name: unzip Version: 5.52 -Release: 7%{?dist} +Release: 8%{?dist} License: BSD Group: Applications/Archiving Source: ftp://ftp.info-zip.org/pub/infozip/src/unzip552.tar.gz @@ -16,6 +16,7 @@ Patch10: unzip-5.52-makefile.patch Patch11: unzip-5.52-open.patch Patch12: unzip-5.52-4GB3.patch Patch13: unzip-5.52-4GB_types.patch +Patch14: unzip-5.52-249057.patch URL: http://www.info-zip.org/pub/infozip/UnZip.html BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -43,6 +44,7 @@ a zip archive. %patch11 -p1 -b .open %patch12 -p1 -b .4GB3 %patch13 -p1 -b .4BG4 +%patch14 -p1 -b .err ln -s unix/Makefile Makefile %build @@ -63,6 +65,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/* %changelog +* Fri Feb 8 2008 Ivana Varekova - 5.52-8 +- fix output when out of space error appears + * Wed Jan 23 2008 Ivana Varekova - 5.52-7 - fix another long file support problem