diff options
author | Paul Fox <pgf@brightstareng.com> | 2005-07-20 19:24:13 +0000 |
---|---|---|
committer | Paul Fox <pgf@brightstareng.com> | 2005-07-20 19:24:13 +0000 |
commit | 94ff9f1010e8594c4918d270f1a0bfa73df7ae79 (patch) | |
tree | 339fe9ad4c7ec7edc98e943954b993c96b6a6d91 /archival | |
parent | 6f267f022f4a1cc47b3b3607f193637262ee69e6 (diff) | |
download | busybox-94ff9f1010e8594c4918d270f1a0bfa73df7ae79.tar.gz |
applying fix for:
0000262: tar -x doesn't believe it has reached the end of archive
Diffstat (limited to 'archival')
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 1ad9ac5e5..513909d5f 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c @@ -62,6 +62,7 @@ extern char get_header_tar(archive_handle_t *archive_handle) } tar; long sum = 0; long i; + static int end = 0; /* Align header */ data_align(archive_handle, 512); @@ -74,8 +75,17 @@ extern char get_header_tar(archive_handle_t *archive_handle) /* If there is no filename its an empty header */ if (tar.formated.name[0] == 0) { + if (end) { + /* This is the second consecutive empty header! End of archive! + * Read until the end to empty the pipe from gz or bz2 + */ + while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512); + return(EXIT_FAILURE); + } + end = 1; return(EXIT_SUCCESS); } + end = 0; /* Check header has valid magic, "ustar" is for the proper tar * 0's are for the old tar format |