diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-03-06 16:33:42 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-03-06 16:33:42 +0100 |
commit | faac1d3e6e87dc6882e69b62f1c71907d892c876 (patch) | |
tree | c9feb257a4d47e71a5555360b0978e22c9e37dbf /archival/libarchive | |
parent | 02c3c3842004d88207b46450dbd19f80e6596c7e (diff) | |
download | busybox-w32-faac1d3e6e87dc6882e69b62f1c71907d892c876.tar.gz busybox-w32-faac1d3e6e87dc6882e69b62f1c71907d892c876.tar.bz2 busybox-w32-faac1d3e6e87dc6882e69b62f1c71907d892c876.zip |
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/libarchive')
-rw-r--r-- | archival/libarchive/open_transformer.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c index 693ae9995..dae04aa57 100644 --- a/archival/libarchive/open_transformer.c +++ b/archival/libarchive/open_transformer.c | |||
@@ -27,6 +27,32 @@ int FAST_FUNC check_signature16(transformer_aux_data_t *aux, int src_fd, unsigne | |||
27 | return 0; | 27 | return 0; |
28 | } | 28 | } |
29 | 29 | ||
30 | void check_errors_in_children(int signo) | ||
31 | { | ||
32 | int status; | ||
33 | |||
34 | if (!signo) { | ||
35 | /* block waiting for any child */ | ||
36 | if (wait(&status) < 0) | ||
37 | return; /* probably there are no children */ | ||
38 | goto check_status; | ||
39 | } | ||
40 | |||
41 | /* Wait for any child without blocking */ | ||
42 | for (;;) { | ||
43 | if (wait_any_nohang(&status) < 0) | ||
44 | /* wait failed?! I'm confused... */ | ||
45 | return; | ||
46 | check_status: | ||
47 | if (WIFEXITED(status) && WEXITSTATUS(status) == 0) | ||
48 | /* this child exited with 0 */ | ||
49 | continue; | ||
50 | /* Cannot happen? | ||
51 | if (!WIFSIGNALED(status) && !WIFEXITED(status)) ???; */ | ||
52 | bb_got_signal = 1; | ||
53 | } | ||
54 | } | ||
55 | |||
30 | /* transformer(), more than meets the eye */ | 56 | /* transformer(), more than meets the eye */ |
31 | #if BB_MMU | 57 | #if BB_MMU |
32 | void FAST_FUNC open_transformer(int fd, | 58 | void FAST_FUNC open_transformer(int fd, |