extract_file(): Report extraction failure.
authorshort <>
Sun, 9 Nov 2003 19:53:26 +0000 (19:53 +0000)
committershort <>
Sun, 9 Nov 2003 19:53:26 +0000 (19:53 +0000)
src/install/acquire/cabextract/cabextract.c
src/install/acquire/cabextract/cabextract.h

index 22824a3..fdac391 100644 (file)
@@ -2724,7 +2724,7 @@ static int decompress(struct file *fi, int savemode, int fix) {
 }
 
 
-void extract_file(struct file *fi, int lower, int fix, char *dir) {
+int extract_file(struct file *fi, int lower, int fix, char *dir) {
   struct folder *fol = fi->folder, *oldfol = CAB(current);
   LONG err = DECR_OK;
 
@@ -2779,7 +2779,10 @@ void extract_file(struct file *fi, int lower, int fix, char *dir) {
     /* initialisation OK, set current folder and reset offset */
 #if 0 /* CAPTIVE */
     if (oldfol) cabinet_close(oldfol->cab[CAB(split)]);
-    if (!cabinet_open(fol->cab[0])) goto exit_handler;
+    if (!cabinet_open(fol->cab[0])) {
+      err = DECR_ILLEGALDATA;
+      goto exit_handler;
+      }
 #endif /* CAPTIVE */
     cabinet_seek(fol->cab[0], fol->offset[0]);
     CAB(current) = fol;
@@ -2794,7 +2797,7 @@ void extract_file(struct file *fi, int lower, int fix, char *dir) {
     CAB(offset) = fi->offset;
   }
 #if 0 /* CAPTIVE */
-  if (!file_open(fi, lower, dir)) return;
+  if (!file_open(fi, lower, dir)) return 0;
 #endif /* CAPTIVE */
   err = decompress(fi, 1, fix);
   if (err) CAB(current) = NULL; else CAB(offset) += fi->length;
@@ -2830,7 +2833,9 @@ exit_handler:
     }
 
     g_warning(errmsg, cabname);
+    return 0;
   }
+  return 1;
 }
 
 #if 0 /* CAPTIVE */
index b99223b..6661720 100644 (file)
@@ -61,7 +61,7 @@ struct file {
 
 struct cabinet *find_cabs_in_file(struct acquire_cabinet *acquire_cabinet);
 struct file *process_files(struct cabinet *basecab);
-void extract_file(struct file *fi, int lower, int fix, char *dir);
+int extract_file(struct file *fi, int lower, int fix, char *dir);
 
 G_END_DECLS