diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-08 04:19:36 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-08 04:19:36 +0000 |
commit | 87a770d4123c1323068a5b3f01c805e715ea3024 (patch) | |
tree | 0cad244c41481b67718f1fe42b67f7cb4a223398 /zcmp.cc | |
parent | Adding upstream version 0.9~rc1. (diff) | |
download | zutils-87a770d4123c1323068a5b3f01c805e715ea3024.tar.xz zutils-87a770d4123c1323068a5b3f01c805e715ea3024.zip |
Adding upstream version 0.9~rc2.upstream/0.9_rc2
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'zcmp.cc')
-rw-r--r-- | zcmp.cc | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -20,6 +20,7 @@ #include <cctype> #include <cerrno> #include <climits> +#include <csignal> #include <cstdio> #include <cstdlib> #include <cstring> @@ -469,10 +470,15 @@ int main( const int argc, const char * const argv[] ) int retval = cmp( max_size, infd, filenames, print_bytes ); - if( ( ( pid[0] && wait_for_child( pid[0], "data feeder" ) != 0 ) || - ( pid[1] && wait_for_child( pid[1], "data feeder" ) != 0 ) ) && - retval == 0 ) - retval = 2; + if( retval != 0 ) + { + if( pid[0] ) kill( pid[0], SIGTERM ); + if( pid[1] ) kill( pid[1], SIGTERM ); + } + else + if( ( pid[0] && wait_for_child( pid[0], "data feeder" ) != 0 ) || + ( pid[1] && wait_for_child( pid[1], "data feeder" ) != 0 ) ) + retval = 2; for( int i = 0; i < 2; ++i ) { |