diff options
author | Denys Vlasenko | 2012-03-06 16:33:42 +0100 |
---|---|---|
committer | Denys Vlasenko | 2012-03-06 16:33:42 +0100 |
commit | faac1d3e6e87dc6882e69b62f1c71907d892c876 (patch) | |
tree | c9feb257a4d47e71a5555360b0978e22c9e37dbf /archival/libarchive/open_transformer.c | |
parent | 02c3c3842004d88207b46450dbd19f80e6596c7e (diff) | |
download | busybox-faac1d3e6e87dc6882e69b62f1c71907d892c876.zip busybox-faac1d3e6e87dc6882e69b62f1c71907d892c876.tar.gz |
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/open_transformer.c')
-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 693ae99..dae04aa 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 return 0; } +void check_errors_in_children(int signo) +{ + int status; + + if (!signo) { + /* block waiting for any child */ + if (wait(&status) < 0) + return; /* probably there are no children */ + goto check_status; + } + + /* Wait for any child without blocking */ + for (;;) { + if (wait_any_nohang(&status) < 0) + /* wait failed?! I'm confused... */ + return; + check_status: + if (WIFEXITED(status) && WEXITSTATUS(status) == 0) + /* this child exited with 0 */ + continue; + /* Cannot happen? + if (!WIFSIGNALED(status) && !WIFEXITED(status)) ???; */ + bb_got_signal = 1; + } +} + /* transformer(), more than meets the eye */ #if BB_MMU void FAST_FUNC open_transformer(int fd, |