[BusyBox-cvs] busybox/archival/libunarchive get_header_ar.c, 1.6, 1.7

Glenn McGrath bug1 at busybox.net
Thu Jul 31 01:53:54 UTC 2003


Update of /var/cvs/busybox/archival/libunarchive
In directory winder:/tmp/cvs-serv31927

Modified Files:
	get_header_ar.c 
Log Message:
Fix bug when handling debian packages.
If we read the contents of compressed files within the ar archive,
e.g. control.tar.gz, then file position gets all out of whack, so
it has to be reset before reading thenext header.


Index: get_header_ar.c
===================================================================
RCS file: /var/cvs/busybox/archival/libunarchive/get_header_ar.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- get_header_ar.c	19 Mar 2003 09:11:25 -0000	1.6
+++ get_header_ar.c	31 Jul 2003 01:53:50 -0000	1.7
@@ -45,7 +45,7 @@
 	if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
 		/* End Of File */
 		return(EXIT_FAILURE);
-		}
+	}
 
 	/* Some ar entries have a trailing '\n' after the previous data entry */
 	if (ar.raw[0] == '\n') {
@@ -55,7 +55,7 @@
 		archive_handle->offset++;
 	}
 	archive_handle->offset += 60;
-		
+
 	/* align the headers based on the header magic */
 	if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) {
 		bb_error_msg_and_die("Invalid ar header");
@@ -115,7 +115,9 @@
 		data_skip(archive_handle);			
 	}
 
-	archive_handle->offset += typed->size + 1;
+	archive_handle->offset += typed->size;
+	/* Set the file pointer to the correct spot, we may have been reading a compressed file */
+	lseek(archive_handle->src_fd, archive_handle->offset, SEEK_SET);
 
 	return(EXIT_SUCCESS);
 }




More information about the busybox-cvs mailing list