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>
This commit is contained in:
Denys Vlasenko
2011-10-31 01:05:16 +01:00
parent b076193f74
commit c531b9a3e4
4 changed files with 36 additions and 50 deletions

View File

@@ -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;
}