aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/bbunzip.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 54dc2f5f1..d59c65571 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -66,12 +66,17 @@ int FAST_FUNC bbunpack(char **argv,
66 if (open_to_or_warn(STDIN_FILENO, filename, O_RDONLY, 0)) 66 if (open_to_or_warn(STDIN_FILENO, filename, O_RDONLY, 0))
67 goto err; 67 goto err;
68 } else { 68 } else {
69 /* "clever zcat" */ 69 /* "clever zcat" with FILE */
70 int fd = open_zipped(filename); 70 int fd = open_zipped(filename);
71 if (fd < 0) 71 if (fd < 0)
72 goto err_name; 72 goto err_name;
73 xmove_fd(fd, STDIN_FILENO); 73 xmove_fd(fd, STDIN_FILENO);
74 } 74 }
75 } else
76 if (option_mask32 & SEAMLESS_MAGIC) {
77 /* "clever zcat" on stdin */
78 if (setup_unzip_on_fd(STDIN_FILENO, /*fail_if_not_detected*/ 0))
79 goto err;
75 } 80 }
76 81
77 /* Special cases: test, stdout */ 82 /* Special cases: test, stdout */
@@ -115,15 +120,9 @@ int FAST_FUNC bbunpack(char **argv,
115 if (status < 0) 120 if (status < 0)
116 exitcode = 1; 121 exitcode = 1;
117 } else { 122 } else {
118 /* "clever zcat" */ 123 if (bb_copyfd_eof(STDIN_FILENO, STDOUT_FILENO) < 0)
119 if (!filename) {
120 if (setup_unzip_on_fd(STDIN_FILENO, /*fail_if_not_detected*/ 0))
121 goto err;
122 }
123 if (bb_copyfd_eof(STDIN_FILENO, STDOUT_FILENO) < 0) {
124 /* Disk full, tty closed, etc. No point in continuing */ 124 /* Disk full, tty closed, etc. No point in continuing */
125 xfunc_die(); 125 xfunc_die();
126 }
127 } 126 }
128 127
129 if (!(option_mask32 & OPT_STDOUT)) 128 if (!(option_mask32 & OPT_STDOUT))