1 diff -up unzip60/extract.c.close unzip60/extract.c
2 --- unzip60/extract.c.close 2009-03-14 02:32:52.000000000 +0100
3 +++ unzip60/extract.c 2009-11-19 08:17:23.481263496 +0100
4 @@ -1924,24 +1924,21 @@ static int extract_or_test_member(__G)
6 #ifdef VMS /* VMS: required even for stdout! (final flush) */
7 if (!uO.tflag) /* don't close NULL file */
9 + error = close_outfile(__G);
12 if (!uO.tflag && (!uO.cflag || G.redirect_data)) {
17 + error = close_outfile(__G);
20 if (!uO.tflag && !uO.cflag) /* don't close NULL file or stdout */
22 + error = close_outfile(__G);
26 - /* GRR: CONVERT close_outfile() TO NON-VOID: CHECK FOR ERRORS! */
29 if (G.disk_full) { /* set by flush() */
30 if (G.disk_full > 1) {
31 #if (defined(DELETE_IF_FULL) && defined(HAVE_UNLINK))
32 diff -up unzip60/unix/unix.c.close unzip60/unix/unix.c
33 --- unzip60/unix/unix.c.close 2009-01-24 00:31:26.000000000 +0100
34 +++ unzip60/unix/unix.c 2009-11-19 08:33:25.568389171 +0100
35 @@ -1096,10 +1096,41 @@ static int get_extattribs(__G__ pzt, z_u
38 /****************************/
39 +/* Function CloseError() */
40 +/***************************/
47 + if (fclose(G.outfile) < 0) {
50 + /* Do we need this on fileio.c? */
51 + Info(slide, 0x4a1, ((char *)slide, "%s: write error (disk full?). Continue? (y/n/^C) ",
52 + FnFilter1(G.filename)));
53 + fgets(G.answerbuf, 9, stdin);
54 + if (*G.answerbuf == 'y') /* stop writing to this file */
55 + G.disk_full = 1; /* pass to next */
57 + G.disk_full = 2; /* no: exit program */
67 +} /* End of CloseError() */
69 +/****************************/
70 /* Function close_outfile() */
71 /****************************/
73 -void close_outfile(__G) /* GRR: change to return PK-style warning level */
74 +int close_outfile(__G)
78 @@ -1108,6 +1139,7 @@ void close_outfile(__G) /* GRR: chang
84 have_uidgid_flg = get_extattribs(__G__ &(zt.t3), z_uidgid);
86 @@ -1141,16 +1173,16 @@ void close_outfile(__G) /* GRR: chang
87 Info(slide, 0x201, ((char *)slide,
88 "warning: symbolic link (%s) failed: mem alloc overflow\n",
89 FnFilter1(G.filename)));
92 + errval = CloseError(G.outfile, G.filename);
93 + return errval ? errval : PK_WARN;
96 if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
97 Info(slide, 0x201, ((char *)slide,
98 "warning: symbolic link (%s) failed: no mem\n",
99 FnFilter1(G.filename)));
102 + errval = CloseError(G.outfile, G.filename);
103 + return errval ? errval : PK_WARN;
105 slnk_entry->next = NULL;
106 slnk_entry->targetlen = ucsize;
107 @@ -1174,10 +1206,10 @@ void close_outfile(__G) /* GRR: chang
108 "warning: symbolic link (%s) failed\n",
109 FnFilter1(G.filename)));
113 + errval = CloseError(G.outfile, G.filename);
114 + return errval ? errval : PK_WARN;
116 - fclose(G.outfile); /* close "link" file for good... */
117 + errval = CloseError(G.outfile, G.filename); /* close "link" file for good... */
118 slnk_entry->target[ucsize] = '\0';
120 Info(slide, 0, ((char *)slide, "-> %s ",
121 @@ -1188,7 +1220,7 @@ void close_outfile(__G) /* GRR: chang
123 G.slink_head = slnk_entry;
124 G.slink_last = slnk_entry;
128 #endif /* SYMLINKS */
130 @@ -1201,7 +1233,7 @@ void close_outfile(__G) /* GRR: chang
133 #if (defined(NO_FCHOWN))
135 + errval = CloseError(G.outfile, G.filename);
138 /* if -X option was specified and we have UID/GID info, restore it */
139 @@ -1227,7 +1259,7 @@ void close_outfile(__G) /* GRR: chang
142 #if (!defined(NO_FCHOWN) && defined(NO_FCHMOD))
144 + errval = CloseError(G.outfile, G.filename);
147 #if (!defined(NO_FCHOWN) && !defined(NO_FCHMOD))
148 @@ -1239,7 +1271,7 @@ void close_outfile(__G) /* GRR: chang
149 if (fchmod(fileno(G.outfile), filtattr(__G__ G.pInfo->file_attr)))
150 perror("fchmod (file attributes) error");
153 + errval = CloseError(G.outfile, G.filename);
154 #endif /* !NO_FCHOWN && !NO_FCHMOD */
156 /* skip restoring time stamps on user's request */
157 @@ -1267,6 +1299,7 @@ void close_outfile(__G) /* GRR: chang
159 #endif /* NO_FCHOWN || NO_FCHMOD */
162 } /* end function close_outfile() */
165 diff -up unzip60/unzpriv.h.close unzip60/unzpriv.h
166 --- unzip60/unzpriv.h.close 2009-04-20 01:59:26.000000000 +0200
167 +++ unzip60/unzpriv.h 2009-11-19 08:19:08.610388618 +0100
168 @@ -2604,7 +2604,7 @@ char *GetLoadPath OF((__GPRO));
169 int SetFileSize OF((FILE *file, zusz_t filesize)); /* local */
171 #ifndef MTS /* macro in MTS */
172 - void close_outfile OF((__GPRO)); /* local */
173 + int close_outfile OF((__GPRO)); /* local */
175 #ifdef SET_SYMLINK_ATTRIBS
176 int set_symlnk_attribs OF((__GPRO__ slinkentry *slnk_entry)); /* local */