svn commit: trunk/busybox/archival/libunarchive

vda at busybox.net vda at busybox.net
Wed Feb 13 17:52:43 UTC 2008


Author: vda
Date: 2008-02-13 09:52:42 -0800 (Wed, 13 Feb 2008)
New Revision: 21009

Log:
tar: compat: handle tarballs with only one zero block at the end



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	2008-02-13 17:25:31 UTC (rev 21008)
+++ trunk/busybox/archival/libunarchive/get_header_tar.c	2008-02-13 17:52:42 UTC (rev 21009)
@@ -90,7 +90,15 @@
 
  again_after_align:
 
-	xread(archive_handle->src_fd, &tar, 512);
+	i = full_read(archive_handle->src_fd, &tar, 512);
+	/* if GNU tar sees EOF in above read, it says:
+	 * "tar: A lone zero block at N", where N = kilobyte
+	 * where EOF was met (not EOF block, actual EOF!),
+	 * and tar will exit with error code 0! Mimic exit(0): */
+	if (i == 0)
+		xfunc_error_retval = 0;
+	if (i != 512)
+		bb_error_msg_and_die("short read");
 	archive_handle->offset += 512;
 
 	/* If there is no filename its an empty header */




More information about the busybox-cvs mailing list