aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/tar.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 3877ea4db..bd61abd57 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -1196,8 +1196,14 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1196 /*tar_handle->offset = 0; - already is */ 1196 /*tar_handle->offset = 0; - already is */
1197 } 1197 }
1198 1198
1199 /* Zero processed headers (== empty file) is not a valid tarball.
1200 * We (ab)use bb_got_signal as exitcode here,
1201 * because check_errors_in_children() uses _it_ as error indicator.
1202 */
1203 bb_got_signal = EXIT_FAILURE;
1204
1199 while (get_header_tar(tar_handle) == EXIT_SUCCESS) 1205 while (get_header_tar(tar_handle) == EXIT_SUCCESS)
1200 continue; 1206 bb_got_signal = EXIT_SUCCESS; /* saw at least one header, good */
1201 1207
1202 /* Check that every file that should have been extracted was */ 1208 /* Check that every file that should have been extracted was */
1203 while (tar_handle->accept) { 1209 while (tar_handle->accept) {
@@ -1213,8 +1219,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1213 close(tar_handle->src_fd); 1219 close(tar_handle->src_fd);
1214 1220
1215 if (SEAMLESS_COMPRESSION || OPT_COMPRESS) { 1221 if (SEAMLESS_COMPRESSION || OPT_COMPRESS) {
1222 /* Set bb_got_signal to 1 if a child died with !0 exitcode */
1216 check_errors_in_children(0); 1223 check_errors_in_children(0);
1217 return bb_got_signal;
1218 } 1224 }
1219 return EXIT_SUCCESS; 1225
1226 return bb_got_signal;
1220} 1227}