aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/bbunzip.c7
-rw-r--r--archival/libarchive/decompress_bunzip2.c9
2 files changed, 14 insertions, 2 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,
103 status = unpacker(&info); 103 status = unpacker(&info);
104 if (status < 0) 104 if (status < 0)
105 exitcode = 1; 105 exitcode = 1;
106 xclose(STDOUT_FILENO); /* with error check! */ 106
107 if (!(option_mask32 & OPT_STDOUT))
108 xclose(STDOUT_FILENO); /* with error check! */
107 109
108 if (filename) { 110 if (filename) {
109 char *del = new_name; 111 char *del = new_name;
@@ -143,6 +145,9 @@ int FAST_FUNC bbunpack(char **argv,
143 } 145 }
144 } while (*argv && *++argv); 146 } while (*argv && *++argv);
145 147
148 if (option_mask32 & OPT_STDOUT)
149 xclose(STDOUT_FILENO); /* with error check! */
150
146 return exitcode; 151 return exitcode;
147} 152}
148 153
diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c
index cd3144743..c4640d489 100644
--- a/archival/libarchive/decompress_bunzip2.c
+++ b/archival/libarchive/decompress_bunzip2.c
@@ -752,7 +752,14 @@ unpack_bz2_stream(int src_fd, int dst_fd)
752 } 752 }
753 } 753 }
754 754
755 if (i != RETVAL_LAST_BLOCK) { 755 if (i != RETVAL_LAST_BLOCK
756 /* Observed case when i == RETVAL_OK:
757 * "bzcat z.bz2", where "z.bz2" is a bzipped zero-length file
758 * (to be exact, z.bz2 is exactly these 14 bytes:
759 * 42 5a 68 39 17 72 45 38 50 90 00 00 00 00).
760 */
761 && i != RETVAL_OK
762 ) {
756 bb_error_msg("bunzip error %d", i); 763 bb_error_msg("bunzip error %d", i);
757 break; 764 break;
758 } 765 }