mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
Don't respawn if child died in less than a second.
This commit is contained in:
parent
c2ad749f99
commit
3013b89b03
1 changed files with 6 additions and 0 deletions
|
@ -631,8 +631,14 @@ int main( int argc, char** argv )
|
|||
} else if ( pid > 0 ) {
|
||||
int status;
|
||||
logf( XW_LOGINFO, "parent waiting on child pid=%d", pid );
|
||||
time_t time_before = time( NULL );
|
||||
waitpid( pid, &status, 0 );
|
||||
printWhy( status );
|
||||
time_t time_after = time( NULL );
|
||||
doFork = time_after > time_before;
|
||||
if ( !doFork ) {
|
||||
logf( XW_LOGERROR, "exiting b/c respawned too quickly" );
|
||||
}
|
||||
} else {
|
||||
logf( XW_LOGERROR, "fork() => %s", strerror(errno) );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue