|
|
f7a027 |
diff -up unzip60/extract.c.close unzip60/extract.c
|
|
|
f7a027 |
--- unzip60/extract.c.close 2009-03-14 02:32:52.000000000 +0100
|
|
|
f7a027 |
+++ unzip60/extract.c 2009-11-19 08:17:23.481263496 +0100
|
|
|
f7a027 |
@@ -1924,24 +1924,21 @@ static int extract_or_test_member(__G)
|
|
|
f7a027 |
|
|
|
f7a027 |
#ifdef VMS /* VMS: required even for stdout! (final flush) */
|
|
|
f7a027 |
if (!uO.tflag) /* don't close NULL file */
|
|
|
f7a027 |
- close_outfile(__G);
|
|
|
f7a027 |
+ error = close_outfile(__G);
|
|
|
f7a027 |
#else
|
|
|
f7a027 |
#ifdef DLL
|
|
|
f7a027 |
if (!uO.tflag && (!uO.cflag || G.redirect_data)) {
|
|
|
f7a027 |
if (G.redirect_data)
|
|
|
f7a027 |
FINISH_REDIRECT();
|
|
|
f7a027 |
else
|
|
|
f7a027 |
- close_outfile(__G);
|
|
|
f7a027 |
+ error = close_outfile(__G);
|
|
|
f7a027 |
}
|
|
|
f7a027 |
#else
|
|
|
f7a027 |
if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */
|
|
|
f7a027 |
- close_outfile(__G);
|
|
|
f7a027 |
+ error = close_outfile(__G);
|
|
|
f7a027 |
#endif
|
|
|
f7a027 |
#endif /* VMS */
|
|
|
f7a027 |
|
|
|
f7a027 |
- /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */
|
|
|
f7a027 |
-
|
|
|
f7a027 |
-
|
|
|
f7a027 |
if (G.disk_full) { /* set by flush() */
|
|
|
f7a027 |
if (G.disk_full > 1) {
|
|
|
f7a027 |
#if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK))
|
|
|
f7a027 |
diff -up unzip60/unix/unix.c.close unzip60/unix/unix.c
|
|
|
f7a027 |
--- unzip60/unix/unix.c.close 2009-01-24 00:31:26.000000000 +0100
|
|
|
f7a027 |
+++ unzip60/unix/unix.c 2009-11-19 08:33:25.568389171 +0100
|
|
|
f7a027 |
@@ -1096,10 +1096,41 @@ static int get_extattribs(__G__ pzt, z_u
|
|
|
f7a027 |
#ifndef MTS
|
|
|
f7a027 |
|
|
|
f7a027 |
/****************************/
|
|
|
f7a027 |
+/* Function CloseError() */
|
|
|
f7a027 |
+/***************************/
|
|
|
f7a027 |
+
|
|
|
f7a027 |
+int CloseError(__G)
|
|
|
f7a027 |
+ __GDEF
|
|
|
f7a027 |
+{
|
|
|
f7a027 |
+ int errval = PK_OK;
|
|
|
f7a027 |
+
|
|
|
f7a027 |
+ if (fclose(G.outfile) < 0) {
|
|
|
f7a027 |
+ switch (errno) {
|
|
|
f7a027 |
+ case ENOSPC:
|
|
|
f7a027 |
+ /* Do we need this on fileio.c? */
|
|
|
f7a027 |
+ Info(slide, 0x4a1, ((char *)slide, "%s: write error (disk full?). Continue? (y/n/^C) ",
|
|
|
f7a027 |
+ FnFilter1(G.filename)));
|
|
|
f7a027 |
+ fgets(G.answerbuf, 9, stdin);
|
|
|
f7a027 |
+ if (*G.answerbuf == 'y') /* stop writing to this file */
|
|
|
f7a027 |
+ G.disk_full = 1; /* pass to next */
|
|
|
f7a027 |
+ else
|
|
|
f7a027 |
+ G.disk_full = 2; /* no: exit program */
|
|
|
f7a027 |
+
|
|
|
f7a027 |
+ errval = PK_DISK;
|
|
|
f7a027 |
+ break;
|
|
|
f7a027 |
+
|
|
|
f7a027 |
+ default:
|
|
|
f7a027 |
+ errval = PK_WARN;
|
|
|
f7a027 |
+ }
|
|
|
f7a027 |
+ }
|
|
|
f7a027 |
+ return errval;
|
|
|
f7a027 |
+} /* End of CloseError() */
|
|
|
f7a027 |
+
|
|
|
f7a027 |
+/****************************/
|
|
|
f7a027 |
/* Function close_outfile() */
|
|
|
f7a027 |
/****************************/
|
|
|
f7a027 |
|
|
|
f7a027 |
-void close_outfile(__G) /* GRR: change to return PK-style warning level */
|
|
|
f7a027 |
+int close_outfile(__G)
|
|
|
f7a027 |
__GDEF
|
|
|
f7a027 |
{
|
|
|
f7a027 |
union {
|
|
|
f7a027 |
@@ -1108,6 +1139,7 @@ void close_outfile(__G) /* GRR: chang
|
|
|
f7a027 |
} zt;
|
|
|
f7a027 |
ulg z_uidgid[2];
|
|
|
f7a027 |
int have_uidgid_flg;
|
|
|
f7a027 |
+ int errval = PK_OK;
|
|
|
f7a027 |
|
|
|
f7a027 |
have_uidgid_flg = get_extattribs(__G__ &(zt.t3), z_uidgid);
|
|
|
f7a027 |
|
|
|
f7a027 |
@@ -1141,16 +1173,16 @@ void close_outfile(__G) /* GRR: chang
|
|
|
f7a027 |
Info(slide, 0x201, ((char *)slide,
|
|
|
f7a027 |
"warning: symbolic link (%s) failed: mem alloc overflow\n",
|
|
|
f7a027 |
FnFilter1(G.filename)));
|
|
|
f7a027 |
- fclose(G.outfile);
|
|
|
f7a027 |
- return;
|
|
|
f7a027 |
+ errval = CloseError(G.outfile, G.filename);
|
|
|
f7a027 |
+ return errval ? errval : PK_WARN;
|
|
|
f7a027 |
}
|
|
|
f7a027 |
|
|
|
f7a027 |
if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
|
|
|
f7a027 |
Info(slide, 0x201, ((char *)slide,
|
|
|
f7a027 |
"warning: symbolic link (%s) failed: no mem\n",
|
|
|
f7a027 |
FnFilter1(G.filename)));
|
|
|
f7a027 |
- fclose(G.outfile);
|
|
|
f7a027 |
- return;
|
|
|
f7a027 |
+ errval = CloseError(G.outfile, G.filename);
|
|
|
f7a027 |
+ return errval ? errval : PK_WARN;
|
|
|
f7a027 |
}
|
|
|
f7a027 |
slnk_entry->next = NULL;
|
|
|
f7a027 |
slnk_entry->targetlen = ucsize;
|
|
|
f7a027 |
@@ -1174,10 +1206,10 @@ void close_outfile(__G) /* GRR: chang
|
|
|
f7a027 |
"warning: symbolic link (%s) failed\n",
|
|
|
f7a027 |
FnFilter1(G.filename)));
|
|
|
f7a027 |
free(slnk_entry);
|
|
|
f7a027 |
- fclose(G.outfile);
|
|
|
f7a027 |
- return;
|
|
|
f7a027 |
+ errval = CloseError(G.outfile, G.filename);
|
|
|
f7a027 |
+ return errval ? errval : PK_WARN;
|
|
|
f7a027 |
}
|
|
|
f7a027 |
- fclose(G.outfile); /* close "link" file for good... */
|
|
|
f7a027 |
+ errval = CloseError(G.outfile, G.filename); /* close "link" file for good... */
|
|
|
f7a027 |
slnk_entry->target[ucsize] = '\0';
|
|
|
f7a027 |
if (QCOND2)
|
|
|
f7a027 |
Info(slide, 0, ((char *)slide, "-> %s ",
|
|
|
f7a027 |
@@ -1188,7 +1220,7 @@ void close_outfile(__G) /* GRR: chang
|
|
|
f7a027 |
else
|
|
|
f7a027 |
G.slink_head = slnk_entry;
|
|
|
f7a027 |
G.slink_last = slnk_entry;
|
|
|
f7a027 |
- return;
|
|
|
f7a027 |
+ return errval;
|
|
|
f7a027 |
}
|
|
|
f7a027 |
#endif /* SYMLINKS */
|
|
|
f7a027 |
|
|
|
f7a027 |
@@ -1201,7 +1233,7 @@ void close_outfile(__G) /* GRR: chang
|
|
|
f7a027 |
#endif
|
|
|
f7a027 |
|
|
|
f7a027 |
#if (defined(NO_FCHOWN))
|
|
|
f7a027 |
- fclose(G.outfile);
|
|
|
f7a027 |
+ errval = CloseError(G.outfile, G.filename);
|
|
|
f7a027 |
#endif
|
|
|
f7a027 |
|
|
|
f7a027 |
/* if -X option was specified and we have UID/GID info, restore it */
|
|
|
f7a027 |
@@ -1227,7 +1259,7 @@ void close_outfile(__G) /* GRR: chang
|
|
|
f7a027 |
}
|
|
|
f7a027 |
|
|
|
f7a027 |
#if (!defined(NO_FCHOWN) && defined(NO_FCHMOD))
|
|
|
f7a027 |
- fclose(G.outfile);
|
|
|
f7a027 |
+ errval = CloseError(G.outfile, G.filename);
|
|
|
f7a027 |
#endif
|
|
|
f7a027 |
|
|
|
f7a027 |
#if (!defined(NO_FCHOWN) && !defined(NO_FCHMOD))
|
|
|
f7a027 |
@@ -1239,7 +1271,7 @@ void close_outfile(__G) /* GRR: chang
|
|
|
f7a027 |
if (fchmod(fileno(G.outfile), filtattr(__G__ G.pInfo->file_attr)))
|
|
|
f7a027 |
perror("fchmod (file attributes) error");
|
|
|
f7a027 |
|
|
|
f7a027 |
- fclose(G.outfile);
|
|
|
f7a027 |
+ errval = CloseError(G.outfile, G.filename);
|
|
|
f7a027 |
#endif /* !NO_FCHOWN && !NO_FCHMOD */
|
|
|
f7a027 |
|
|
|
f7a027 |
/* skip restoring time stamps on user's request */
|
|
|
f7a027 |
@@ -1267,6 +1299,7 @@ void close_outfile(__G) /* GRR: chang
|
|
|
f7a027 |
#endif
|
|
|
f7a027 |
#endif /* NO_FCHOWN || NO_FCHMOD */
|
|
|
f7a027 |
|
|
|
f7a027 |
+ return errval;
|
|
|
f7a027 |
} /* end function close_outfile() */
|
|
|
f7a027 |
|
|
|
f7a027 |
#endif /* !MTS */
|
|
|
f7a027 |
diff -up unzip60/unzpriv.h.close unzip60/unzpriv.h
|
|
|
f7a027 |
--- unzip60/unzpriv.h.close 2009-04-20 01:59:26.000000000 +0200
|
|
|
f7a027 |
+++ unzip60/unzpriv.h 2009-11-19 08:19:08.610388618 +0100
|
|
|
f7a027 |
@@ -2604,7 +2604,7 @@ char *GetLoadPath OF((__GPRO));
|
|
|
f7a027 |
int SetFileSize OF((FILE *file, zusz_t filesize)); /* local */
|
|
|
f7a027 |
#endif
|
|
|
f7a027 |
#ifndef MTS /* macro in MTS */
|
|
|
f7a027 |
- void close_outfile OF((__GPRO)); /* local */
|
|
|
f7a027 |
+ int close_outfile OF((__GPRO)); /* local */
|
|
|
f7a027 |
#endif
|
|
|
f7a027 |
#ifdef SET_SYMLINK_ATTRIBS
|
|
|
f7a027 |
int set_symlnk_attribs OF((__GPRO__ slinkentry *slnk_entry)); /* local */
|