diff options
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) | |||
62 | } tar; | 62 | } tar; |
63 | long sum = 0; | 63 | long sum = 0; |
64 | long i; | 64 | long i; |
65 | static int end = 0; | ||
65 | 66 | ||
66 | /* Align header */ | 67 | /* Align header */ |
67 | data_align(archive_handle, 512); | 68 | data_align(archive_handle, 512); |
@@ -74,8 +75,17 @@ extern char get_header_tar(archive_handle_t *archive_handle) | |||
74 | 75 | ||
75 | /* If there is no filename its an empty header */ | 76 | /* If there is no filename its an empty header */ |
76 | if (tar.formated.name[0] == 0) { | 77 | if (tar.formated.name[0] == 0) { |
78 | if (end) { | ||
79 | /* This is the second consecutive empty header! End of archive! | ||
80 | * Read until the end to empty the pipe from gz or bz2 | ||
81 | */ | ||
82 | while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512); | ||
83 | return(EXIT_FAILURE); | ||
84 | } | ||
85 | end = 1; | ||
77 | return(EXIT_SUCCESS); | 86 | return(EXIT_SUCCESS); |
78 | } | 87 | } |
88 | end = 0; | ||
79 | 89 | ||
80 | /* Check header has valid magic, "ustar" is for the proper tar | 90 | /* Check header has valid magic, "ustar" is for the proper tar |
81 | * 0's are for the old tar format | 91 | * 0's are for the old tar format |