aboutsummaryrefslogtreecommitdiff
path: root/archival/libunarchive
diff options
context:
space:
mode:
Diffstat (limited to 'archival/libunarchive')
-rw-r--r--archival/libunarchive/data_extract_all.c4
-rw-r--r--archival/libunarchive/data_extract_to_buffer.c3
-rw-r--r--archival/libunarchive/data_extract_to_stdout.c6
-rw-r--r--archival/libunarchive/get_header_ar.c3
-rw-r--r--archival/libunarchive/get_header_tar.c2
-rw-r--r--archival/libunarchive/seek_by_read.c5
6 files changed, 12 insertions, 11 deletions
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 67f8f3534..25bf028d2 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 95cb8f576..d8fcdf3d3 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 788246ce7..2e266c046 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 7f8c81ca0..6638c65aa 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 66c3314a1..beb8687c7 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 d56f94b21..e46af4842 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);
}