diff options
author | Denis Vlasenko | 2006-12-22 00:21:07 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-12-22 00:21:07 +0000 |
commit | 714701c890b5f03253c5ecdb7367c4258ce78715 (patch) | |
tree | 7ddaf73cf2deda0f357b21802dab4d42798dd778 /archival/libunarchive | |
parent | 0a8a7741795880201bcf78231d1eab0e2538bb0b (diff) | |
download | busybox-714701c890b5f03253c5ecdb7367c4258ce78715.zip busybox-714701c890b5f03253c5ecdb7367c4258ce78715.tar.gz |
tar et al: die if bb_copyfd_size copies less than asked for.
(we have bb_copyfd_exact_size now for that kind of usage)
Diffstat (limited to 'archival/libunarchive')
-rw-r--r-- | archival/libunarchive/data_extract_all.c | 4 | ||||
-rw-r--r-- | archival/libunarchive/data_extract_to_buffer.c | 3 | ||||
-rw-r--r-- | archival/libunarchive/data_extract_to_stdout.c | 6 | ||||
-rw-r--r-- | archival/libunarchive/get_header_ar.c | 3 | ||||
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/seek_by_read.c | 5 |
6 files changed, 12 insertions, 11 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c index 67f8f35..25bf028 100644 --- a/archival/libunarchive/data_extract_all.c +++ b/archival/libunarchive/data_extract_all.c @@ -67,10 +67,10 @@ void data_extract_all(archive_handle_t *archive_handle) /* Regular file */ dst_fd = xopen3(file_header->name, O_WRONLY | O_CREAT | O_EXCL, file_header->mode); - bb_copyfd_size(archive_handle->src_fd, dst_fd, file_header->size); + bb_copyfd_exact_size(archive_handle->src_fd, dst_fd, file_header->size); close(dst_fd); break; - } + } case S_IFDIR: res = mkdir(file_header->name, file_header->mode); if ((errno != EISDIR) && (res == -1) diff --git a/archival/libunarchive/data_extract_to_buffer.c b/archival/libunarchive/data_extract_to_buffer.c index 95cb8f5..d8fcdf3 100644 --- a/archival/libunarchive/data_extract_to_buffer.c +++ b/archival/libunarchive/data_extract_to_buffer.c @@ -10,9 +10,8 @@ void data_extract_to_buffer(archive_handle_t *archive_handle) { - const unsigned int size = archive_handle->file_header->size; + unsigned int size = archive_handle->file_header->size; archive_handle->buffer = xzalloc(size + 1); - xread(archive_handle->src_fd, archive_handle->buffer, size); } diff --git a/archival/libunarchive/data_extract_to_stdout.c b/archival/libunarchive/data_extract_to_stdout.c index 788246c..2e266c0 100644 --- a/archival/libunarchive/data_extract_to_stdout.c +++ b/archival/libunarchive/data_extract_to_stdout.c @@ -4,9 +4,11 @@ */ #include "unarchive.h" -#include <unistd.h> +//#include <unistd.h> void data_extract_to_stdout(archive_handle_t *archive_handle) { - bb_copyfd_size(archive_handle->src_fd, STDOUT_FILENO, archive_handle->file_header->size); + bb_copyfd_exact_size(archive_handle->src_fd, + STDOUT_FILENO, + archive_handle->file_header->size); } diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c index 7f8c81c..6638c65 100644 --- a/archival/libunarchive/get_header_ar.c +++ b/archival/libunarchive/get_header_ar.c @@ -96,7 +96,8 @@ char get_header_ar(archive_handle_t *archive_handle) if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) { archive_handle->action_header(typed); if (archive_handle->sub_archive) { - while (archive_handle->action_data_subarchive(archive_handle->sub_archive) == EXIT_SUCCESS); + while (archive_handle->action_data_subarchive(archive_handle->sub_archive) == EXIT_SUCCESS) + /* repeat */; } else { archive_handle->action_data(archive_handle); } diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 66c3314..beb8687 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c @@ -251,7 +251,7 @@ char get_header_tar(archive_handle_t *archive_handle) } /* Strip trailing '/' in directories */ - /* Must be done after mode is set as '/' is used to check if its a directory */ + /* Must be done after mode is set as '/' is used to check if it's a directory */ cp = last_char_is(file_header->name, '/'); if (archive_handle->filter(archive_handle) == EXIT_SUCCESS) { diff --git a/archival/libunarchive/seek_by_read.c b/archival/libunarchive/seek_by_read.c index d56f94b..e46af48 100644 --- a/archival/libunarchive/seek_by_read.c +++ b/archival/libunarchive/seek_by_read.c @@ -13,7 +13,6 @@ */ void seek_by_read(const archive_handle_t *archive_handle, const unsigned int jump_size) { - if (jump_size) { - bb_copyfd_size(archive_handle->src_fd, -1, jump_size); - } + if (jump_size) + bb_copyfd_exact_size(archive_handle->src_fd, -1, jump_size); } |