aboutsummaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorGravatar Denys Vlasenko <vda.linux@googlemail.com>2012-03-06 16:33:42 +0100
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2012-03-06 16:33:42 +0100
commitfaac1d3e6e87dc6882e69b62f1c71907d892c876 (patch)
treec9feb257a4d47e71a5555360b0978e22c9e37dbf /archival/tar.c
parent02c3c3842004d88207b46450dbd19f80e6596c7e (diff)
downloadbusybox-faac1d3e6e87dc6882e69b62f1c71907d892c876.tar.gz
busybox-faac1d3e6e87dc6882e69b62f1c71907d892c876.tar.bz2
tar,rpm2cpio: check that child decompressor did not error out
function old new delta check_errors_in_children - 57 +57 tar_main 833 848 +15 get_header_tar 1720 1733 +13 rpm2cpio_main 147 140 -7 handle_SIGCHLD 41 - -41 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/1 up/down: 85/-48) Total: 37 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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)
# define append_file_list_to_list(x) 0
#endif
-#ifdef CHECK_FOR_CHILD_EXITCODE
-/* Looks like it isn't needed - tar detects malformed (truncated)
- * archive if e.g. bunzip2 fails */
-static int child_error;
-
-static void handle_SIGCHLD(int status)
-{
- /* Actually, 'status' is a signo. We reuse it for other needs */
-
- /* Wait for any child without blocking */
- if (wait_any_nohang(&status) < 0)
- /* wait failed?! I'm confused... */
- return;
-
- if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
- /* child exited with 0 */
- return;
- /* Cannot happen?
- if (!WIFSIGNALED(status) && !WIFEXITED(status)) return; */
- child_error = 1;
-}
-#endif
-
//usage:#define tar_trivial_usage
//usage: "-[" IF_FEATURE_TAR_CREATE("c") "xt"
//usage: IF_FEATURE_SEAMLESS_Z("Z")
@@ -1059,10 +1036,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
if (base_dir)
xchdir(base_dir);
-#ifdef CHECK_FOR_CHILD_EXITCODE
- /* We need to know whether child (gzip/bzip/etc) exits abnormally */
- signal(SIGCHLD, handle_SIGCHLD);
-#endif
+ //if (SEAMLESS_COMPRESSION || OPT_COMPRESS)
+ // /* We need to know whether child (gzip/bzip/etc) exits abnormally */
+ // signal(SIGCHLD, check_errors_in_children);
/* Create an archive */
if (opt & OPT_CREATE) {
@@ -1118,9 +1094,9 @@ int tar_main(int argc UNUSED_PARAM, char **argv)
if (ENABLE_FEATURE_CLEAN_UP /* && tar_handle->src_fd != STDIN_FILENO */)
close(tar_handle->src_fd);
-#ifdef CHECK_FOR_CHILD_EXITCODE
- return bb_got_signal;
-#else
+ if (SEAMLESS_COMPRESSION || OPT_COMPRESS) {
+ check_errors_in_children(0);
+ return bb_got_signal;
+ }
return EXIT_SUCCESS;
-#endif
}