aboutsummaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/archival/tar.c b/archival/tar.c
index af38ac59f..cf972c24c 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -690,29 +690,6 @@ static llist_t *append_file_list_to_list(llist_t *list)
690# define append_file_list_to_list(x) 0 690# define append_file_list_to_list(x) 0
691#endif 691#endif
692 692
693#ifdef CHECK_FOR_CHILD_EXITCODE
694/* Looks like it isn't needed - tar detects malformed (truncated)
695 * archive if e.g. bunzip2 fails */
696static int child_error;
697
698static void handle_SIGCHLD(int status)
699{
700 /* Actually, 'status' is a signo. We reuse it for other needs */
701
702 /* Wait for any child without blocking */
703 if (wait_any_nohang(&status) < 0)
704 /* wait failed?! I'm confused... */
705 return;
706
707 if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
708 /* child exited with 0 */
709 return;
710 /* Cannot happen?
711 if (!WIFSIGNALED(status) && !WIFEXITED(status)) return; */
712 child_error = 1;
713}
714#endif
715
716//usage:#define tar_trivial_usage 693//usage:#define tar_trivial_usage
717//usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt" 694//usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt"
718//usage: IF_FEATURE_SEAMLESS_Z("Z") 695//usage: IF_FEATURE_SEAMLESS_Z("Z")
@@ -1059,10 +1036,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1059 if (base_dir) 1036 if (base_dir)
1060 xchdir(base_dir); 1037 xchdir(base_dir);
1061 1038
1062#ifdef CHECK_FOR_CHILD_EXITCODE 1039 //if (SEAMLESS_COMPRESSION || OPT_COMPRESS)
1063 /* We need to know whether child (gzip/bzip/etc) exits abnormally */ 1040 // /* We need to know whether child (gzip/bzip/etc) exits abnormally */
1064 signal(SIGCHLD, handle_SIGCHLD); 1041 // signal(SIGCHLD, check_errors_in_children);
1065#endif
1066 1042
1067 /* Create an archive */ 1043 /* Create an archive */
1068 if (opt & OPT_CREATE) { 1044 if (opt & OPT_CREATE) {
@@ -1118,9 +1094,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
1118 if (ENABLE_FEATURE_CLEAN_UP /* && tar_handle->src_fd != STDIN_FILENO */) 1094 if (ENABLE_FEATURE_CLEAN_UP /* && tar_handle->src_fd != STDIN_FILENO */)
1119 close(tar_handle->src_fd); 1095 close(tar_handle->src_fd);
1120 1096
1121#ifdef CHECK_FOR_CHILD_EXITCODE 1097 if (SEAMLESS_COMPRESSION || OPT_COMPRESS) {
1122 return bb_got_signal; 1098 check_errors_in_children(0);
1123#else 1099 return bb_got_signal;
1100 }
1124 return EXIT_SUCCESS; 1101 return EXIT_SUCCESS;
1125#endif
1126} 1102}