Browse code

Handle empty files in the middle of archives

git-svn: trunk@1008

Nigel Horne authored on 2004/10/17 01:08:46
Showing 1 changed files
... ...
@@ -21,6 +21,9 @@
21 21
  *
22 22
  * Change History:
23 23
  * $Log: untar.c,v $
24
+ * Revision 1.15  2004/10/16 16:08:46  nigelhorne
25
+ * Handle empty files in the middle of archives
26
+ *
24 27
  * Revision 1.14  2004/10/13 10:18:54  nigelhorne
25 28
  * Added a few extra file types
26 29
  *
... ...
@@ -64,7 +67,7 @@
64 64
  * First draft
65 65
  *
66 66
  */
67
-static	char	const	rcsid[] = "$Id: untar.c,v 1.14 2004/10/13 10:18:54 nigelhorne Exp $";
67
+static	char	const	rcsid[] = "$Id: untar.c,v 1.15 2004/10/16 16:08:46 nigelhorne Exp $";
68 68
 
69 69
 #include <stdio.h>
70 70
 #include <errno.h>
... ...
@@ -241,6 +244,7 @@ cli_untar(const char *dir, int desc)
241 241
 				fclose(outfile);
242 242
 				return CL_EFORMAT;
243 243
 			}
244
+			cli_dbgmsg("cli_untar: size = %d\n", size);
244 245
 		} else { /* write or continue writing file contents */
245 246
 			const int nbytes = size>512? 512:size;
246 247
 			const int nwritten = fwrite(block, 1, nbytes, outfile);
... ...
@@ -250,9 +254,9 @@ cli_untar(const char *dir, int desc)
250 250
 					nwritten, fullname);
251 251
 			}
252 252
 			size -= nbytes;
253
-			if (size == 0)
254
-				in_block = 0;
255 253
 		}
254
+		if (size == 0)
255
+			in_block = 0;
256 256
 	}
257 257
 	if(outfile)
258 258
 		fclose(outfile);