summaryrefslogtreecommitdiff
path: root/archival/libunarchive/get_header_ar.c
diff options
context:
space:
mode:
authorGlenn L McGrath2003-07-31 01:53:50 +0000
committerGlenn L McGrath2003-07-31 01:53:50 +0000
commit91e464632b391ff06cb56ef2b7c1efbaf9592f42 (patch)
tree15df754a2c477b7438d3cd14989a9400b55c714b /archival/libunarchive/get_header_ar.c
parent6a9ca985b81c9f2197efe5090dfd3fff4a2b5fc3 (diff)
downloadbusybox-91e464632b391ff06cb56ef2b7c1efbaf9592f42.zip
busybox-91e464632b391ff06cb56ef2b7c1efbaf9592f42.tar.gz
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.
Diffstat (limited to 'archival/libunarchive/get_header_ar.c')
-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 6c576a8..25fc837 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)
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 @@ extern char get_header_ar(archive_handle_t *archive_handle)
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 @@ extern char get_header_ar(archive_handle_t *archive_handle)
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);
}