summaryrefslogtreecommitdiffstats
path: root/zcmp.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:19:42 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:19:42 +0000
commit511feb57cfea29b1f6ba303cedd1456f5cecd69e (patch)
treed2aaf1e03feec10c28a6e5d156213b3eb76613ea /zcmp.cc
parentAdding debian version 0.9~rc1-1. (diff)
downloadzutils-511feb57cfea29b1f6ba303cedd1456f5cecd69e.tar.xz
zutils-511feb57cfea29b1f6ba303cedd1456f5cecd69e.zip
Merging upstream version 0.9~rc2.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'zcmp.cc')
-rw-r--r--zcmp.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/zcmp.cc b/zcmp.cc
index a2779b9..7951046 100644
--- a/zcmp.cc
+++ b/zcmp.cc
@@ -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 )
{