summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2013-02-28 18:37:04 +0100
committerDenys Vlasenko2013-02-28 18:37:04 +0100
commit41655438c6b61d05ddf3619f31abc1fa3583e2be (patch)
tree2cd59adb50db669a1b39ce37cdbc13a1861ceb53
parent8e96efa32314ec5a4e6ace9a6fe7a1694e2e7d90 (diff)
downloadbusybox-41655438c6b61d05ddf3619f31abc1fa3583e2be.zip
busybox-41655438c6b61d05ddf3619f31abc1fa3583e2be.tar.gz
zcat: fix "zcat FILE" trying to do detection twice
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--archival/bbunzip.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 54dc2f5..d59c655 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -66,12 +66,17 @@ int FAST_FUNC bbunpack(char **argv,
if (open_to_or_warn(STDIN_FILENO, filename, O_RDONLY, 0))
goto err;
} else {
- /* "clever zcat" */
+ /* "clever zcat" with FILE */
int fd = open_zipped(filename);
if (fd < 0)
goto err_name;
xmove_fd(fd, STDIN_FILENO);
}
+ } else
+ if (option_mask32 & SEAMLESS_MAGIC) {
+ /* "clever zcat" on stdin */
+ if (setup_unzip_on_fd(STDIN_FILENO, /*fail_if_not_detected*/ 0))
+ goto err;
}
/* Special cases: test, stdout */
@@ -115,15 +120,9 @@ int FAST_FUNC bbunpack(char **argv,
if (status < 0)
exitcode = 1;
} else {
- /* "clever zcat" */
- if (!filename) {
- if (setup_unzip_on_fd(STDIN_FILENO, /*fail_if_not_detected*/ 0))
- goto err;
- }
- if (bb_copyfd_eof(STDIN_FILENO, STDOUT_FILENO) < 0) {
+ if (bb_copyfd_eof(STDIN_FILENO, STDOUT_FILENO) < 0)
/* Disk full, tty closed, etc. No point in continuing */
xfunc_die();
- }
}
if (!(option_mask32 & OPT_STDOUT))