[BusyBox-cvs] svn commit: trunk/busybox/archival/libunarchive

pgf at busybox.net pgf at busybox.net
Wed Jul 20 19:24:13 UTC 2005


Author: pgf
Date: 2005-07-20 13:24:13 -0600 (Wed, 20 Jul 2005)
New Revision: 10882

Log:
applying fix for:
     0000262: tar -x doesn't believe it has reached the end of archive


Modified:
   trunk/busybox/archival/libunarchive/get_header_tar.c


Changeset:
Modified: trunk/busybox/archival/libunarchive/get_header_tar.c
===================================================================
--- trunk/busybox/archival/libunarchive/get_header_tar.c	2005-07-20 19:18:45 UTC (rev 10881)
+++ trunk/busybox/archival/libunarchive/get_header_tar.c	2005-07-20 19:24:13 UTC (rev 10882)
@@ -62,6 +62,7 @@
 	} tar;
 	long sum = 0;
 	long i;
+	static int end = 0;
 
 	/* Align header */
 	data_align(archive_handle, 512);
@@ -74,8 +75,17 @@
 
 	/* If there is no filename its an empty header */
 	if (tar.formated.name[0] == 0) {
+		if (end) {
+			/* This is the second consecutive empty header! End of archive!
+			 * Read until the end to empty the pipe from gz or bz2
+			 */
+			while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512);
+			return(EXIT_FAILURE);
+		}
+		end = 1;
 		return(EXIT_SUCCESS);
 	}
+	end = 0;
 
 	/* Check header has valid magic, "ustar" is for the proper tar
 	 * 0's are for the old tar format




More information about the busybox-cvs mailing list