tar: fix a bug where autodetection messes up -z on extract

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2011-02-06 20:01:11 +01:00
parent ca18e25525
commit aef441cb4d
4 changed files with 30 additions and 14 deletions

View File

@@ -1060,8 +1060,10 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
tar_handle->src_fd = tar_fd;
tar_handle->seek = seek_by_read;
} else {
if (ENABLE_FEATURE_TAR_AUTODETECT && flags == O_RDONLY) {
get_header_ptr = get_header_tar;
if (ENABLE_FEATURE_TAR_AUTODETECT
&& flags == O_RDONLY
&& get_header_ptr == get_header_tar
) {
tar_handle->src_fd = open_zipped(tar_filename);
if (tar_handle->src_fd < 0)
bb_perror_msg_and_die("can't open '%s'", tar_filename);