summaryrefslogtreecommitdiff
path: root/archival/unzip.c
diff options
context:
space:
mode:
authorGlenn L McGrath2003-11-15 23:19:05 +0000
committerGlenn L McGrath2003-11-15 23:19:05 +0000
commit5699b8525e855a0e851725980964e8755e365f5b (patch)
treefe3d7ead1f80f5b56e44e52a651f368adf92c91d /archival/unzip.c
parent54ac057c0016ac23b7367342f4834e33cf7d47d7 (diff)
downloadbusybox-5699b8525e855a0e851725980964e8755e365f5b.zip
busybox-5699b8525e855a0e851725980964e8755e365f5b.tar.gz
Move from read_gz to the pipe()+fork() method.
open_transformer(), common code for pipe+fork. Function pointer for read() no longer needed. Allow inflate to be initialised with a specified buffer size to avoid over-reading. Reset static variables in inflate_get_next_window to fix a bug where only the first file in a .zip would be be extracted.
Diffstat (limited to 'archival/unzip.c')
-rw-r--r--archival/unzip.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/archival/unzip.c b/archival/unzip.c
index f2d7f49..c670073 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -199,7 +199,8 @@ extern int unzip_main(int argc, char **argv)
archive_handle->action_data(archive_handle);
} else {
dst_fd = bb_xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT);
- inflate(archive_handle->src_fd, dst_fd);
+ inflate_init(zip_header.formated.cmpsize);
+ inflate_unzip(archive_handle->src_fd, dst_fd);
close(dst_fd);
chmod(archive_handle->file_header->name, archive_handle->file_header->mode);
@@ -227,10 +228,8 @@ extern int unzip_main(int argc, char **argv)
/* Data descriptor section */
if (zip_header.formated.flags & 4) {
/* skip over duplicate crc, compressed size and uncompressed size */
- unsigned short i;
- for (i = 0; i != 12; i++) {
- archive_xread_char(archive_handle);
- }
+ unsigned char data_description[12];
+ archive_xread_all(archive_handle, data_description, 12);
archive_handle->offset += 12;
}
}