diff options
Diffstat (limited to 'zutils.cc')
-rw-r--r-- | zutils.cc | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009-2018 Antonio Diaz Diaz. + Copyright (C) 2009-2019 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -143,16 +143,17 @@ bool good_status( const Children & children, const bool finished ) const pid_t pid = children.pid[i]; if( pid ) { - const char * const msg = + const char * const name = ( i & 1 ) ? children.compressor_name : "data feeder"; if( !finished ) { - const int tmp = child_status( pid, msg ); - if( tmp < 0 ) kill( pid, SIGTERM ); // child not terminated + const int tmp = child_status( pid, name ); + if( tmp < 0 ) // child not terminated + { kill( pid, SIGTERM ); wait_for_child( pid, name ); } else if( tmp != 0 ) error = true; // child status != 0 } else - if( wait_for_child( pid, msg ) != 0 ) error = true; + if( wait_for_child( pid, name ) != 0 ) error = true; } } return !error; |