diff options
author | Glenn L McGrath | 2002-11-12 23:34:15 +0000 |
---|---|---|
committer | Glenn L McGrath | 2002-11-12 23:34:15 +0000 |
commit | 034c371bb2ea7d66caf3ac29178ce941837edb9f (patch) | |
tree | b3f14b3d0e56486a016a6b16eace0432407ffd61 /archival | |
parent | 9af8a72f10c97e3b06862203bc4b0d4e6d10e7f5 (diff) | |
download | busybox-034c371bb2ea7d66caf3ac29178ce941837edb9f.zip busybox-034c371bb2ea7d66caf3ac29178ce941837edb9f.tar.gz |
Reduce block size to 512 to prevent short read's when reading from a pipe
Diffstat (limited to 'archival')
-rw-r--r-- | archival/libunarchive/archive_copy_file.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/archival/libunarchive/archive_copy_file.c b/archival/libunarchive/archive_copy_file.c index 22355cc..47d1a52 100644 --- a/archival/libunarchive/archive_copy_file.c +++ b/archival/libunarchive/archive_copy_file.c @@ -19,17 +19,15 @@ #include "libbb.h" #include "unarchive.h" -/* Copy CHUNKSIZE bytes (or untill EOF if chunksize == -1) - * from SRC_FILE to DST_FILE. */ extern void archive_copy_file(const archive_handle_t *archive_handle, const int dst_fd) { - size_t size; - char buffer[BUFSIZ]; + char buffer[512]; off_t chunksize = archive_handle->file_header->size; while (chunksize != 0) { - if (chunksize > BUFSIZ) { - size = BUFSIZ; + size_t size; + if (chunksize > 512) { + size = 512; } else { size = chunksize; } @@ -38,10 +36,7 @@ extern void archive_copy_file(const archive_handle_t *archive_handle, const int if (write(dst_fd, buffer, size) != size) { error_msg_and_die ("Short write"); } - - if (chunksize != -1) { - chunksize -= size; - } + chunksize -= size; } return; |