aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-31 01:53:50 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-07-31 01:53:50 +0000
commitdce1709fddeb98ad24adbe19572f06f206b01eb1 (patch)
tree15df754a2c477b7438d3cd14989a9400b55c714b /archival
parentb4399723efb5764857e5969764a120620ca13441 (diff)
downloadbusybox-w32-dce1709fddeb98ad24adbe19572f06f206b01eb1.tar.gz
busybox-w32-dce1709fddeb98ad24adbe19572f06f206b01eb1.tar.bz2
busybox-w32-dce1709fddeb98ad24adbe19572f06f206b01eb1.zip
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. git-svn-id: svn://busybox.net/trunk/busybox@7146 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/get_header_ar.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c
index 6c576a8da..25fc83781 100644
--- a/archival/libunarchive/get_header_ar.c
+++ b/archival/libunarchive/get_header_ar.c
@@ -45,7 +45,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
45 if (read(archive_handle->src_fd, ar.raw, 60) != 60) { 45 if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
46 /* End Of File */ 46 /* End Of File */
47 return(EXIT_FAILURE); 47 return(EXIT_FAILURE);
48 } 48 }
49 49
50 /* Some ar entries have a trailing '\n' after the previous data entry */ 50 /* Some ar entries have a trailing '\n' after the previous data entry */
51 if (ar.raw[0] == '\n') { 51 if (ar.raw[0] == '\n') {
@@ -55,7 +55,7 @@ extern char get_header_ar(archive_handle_t *archive_handle)
55 archive_handle->offset++; 55 archive_handle->offset++;
56 } 56 }
57 archive_handle->offset += 60; 57 archive_handle->offset += 60;
58 58
59 /* align the headers based on the header magic */ 59 /* align the headers based on the header magic */
60 if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) { 60 if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) {
61 bb_error_msg_and_die("Invalid ar header"); 61 bb_error_msg_and_die("Invalid ar header");
@@ -115,7 +115,9 @@ extern char get_header_ar(archive_handle_t *archive_handle)
115 data_skip(archive_handle); 115 data_skip(archive_handle);
116 } 116 }
117 117
118 archive_handle->offset += typed->size + 1; 118 archive_handle->offset += typed->size;
119 /* Set the file pointer to the correct spot, we may have been reading a compressed file */
120 lseek(archive_handle->src_fd, archive_handle->offset, SEEK_SET);
119 121
120 return(EXIT_SUCCESS); 122 return(EXIT_SUCCESS);
121} 123}