tar: fix --to-command wrt short writes

function                                             old     new   delta
bb_copyfd_exact_size                                  51      98     +47
bb_full_fd_action                                    362     394     +32
get_header_tar                                      1546    1558     +12
data_extract_to_command                              430     439      +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 100/0)             Total: 100 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2010-06-26 18:11:44 +02:00
parent 894fa0ad62
commit d0a8a0d312
2 changed files with 17 additions and 6 deletions

View File

@ -108,7 +108,7 @@ void FAST_FUNC data_extract_to_command(archive_handle_t *archive_handle)
close(p[0]);
/* Our caller is expected to do signal(SIGPIPE, SIG_IGN)
* so that we don't die if child don't read all the input: */
bb_copyfd_exact_size(archive_handle->src_fd, p[1], file_header->size);
bb_copyfd_exact_size(archive_handle->src_fd, p[1], -file_header->size);
close(p[1]);
if (safe_waitpid(pid, &status, 0) == -1)