aboutsummaryrefslogtreecommitdiff
path: root/archival/bbunzip.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-10-31 01:05:16 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-10-31 01:05:16 +0100
commitc531b9a3e4a90fd7c91c78a6991e30bfe0134f34 (patch)
tree63883e7ad41456977664c0a4f2d3b36d980bebd7 /archival/bbunzip.c
parentb076193f741740886a6771cfe7750adb58ce18a0 (diff)
downloadbusybox-c531b9a3e4a90fd7c91c78a6991e30bfe0134f34.tar.gz
bzcat: fix unpacking of more than one file, and unpacking of zero-size bz2. Closes 4393
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/bbunzip.c')
-rw-r--r--archival/bbunzip.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 9c1a73780..853c653c0 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -103,7 +103,9 @@ int FAST_FUNC bbunpack(char **argv,
status = unpacker(&info);
if (status < 0)
exitcode = 1;
- xclose(STDOUT_FILENO); /* with error check! */
+
+ if (!(option_mask32 & OPT_STDOUT))
+ xclose(STDOUT_FILENO); /* with error check! */
if (filename) {
char *del = new_name;
@@ -143,6 +145,9 @@ int FAST_FUNC bbunpack(char **argv,
}
} while (*argv && *++argv);
+ if (option_mask32 & OPT_STDOUT)
+ xclose(STDOUT_FILENO); /* with error check! */
+
return exitcode;
}