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