mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +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 ) {
|
} else if ( pid > 0 ) {
|
||||||
int status;
|
int status;
|
||||||
logf( XW_LOGINFO, "parent waiting on child pid=%d", pid );
|
logf( XW_LOGINFO, "parent waiting on child pid=%d", pid );
|
||||||
|
time_t time_before = time( NULL );
|
||||||
waitpid( pid, &status, 0 );
|
waitpid( pid, &status, 0 );
|
||||||
printWhy( status );
|
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 {
|
} else {
|
||||||
logf( XW_LOGERROR, "fork() => %s", strerror(errno) );
|
logf( XW_LOGERROR, "fork() => %s", strerror(errno) );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue