(trunk libT) #3764 "script-torrent-done shouldn't block libtransmission" -- handle zombie processes.

This commit is contained in:
Charles Kerr 2010-12-15 15:35:06 +00:00
parent 9a5a429761
commit f1e236693d
1 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#include <sys/types.h> /* stat */
#include <sys/stat.h> /* stat */
#include <sys/wait.h> /* wait() */
#include <unistd.h> /* stat */
#include <dirent.h>
@ -1849,6 +1850,12 @@ tr_torrentClearIdleLimitHitCallback( tr_torrent * torrent )
tr_torrentSetIdleLimitHitCallback( torrent, NULL, NULL );
}
static void
onSigCHLD( int i UNUSED )
{
waitpid( -1, 0, WNOHANG );
}
static void
torrentCallScript( const tr_torrent * tor, const char * script )
{
@ -1873,6 +1880,7 @@ torrentCallScript( const tr_torrent * tor, const char * script )
NULL };
tr_torinf( tor, "Calling script \"%s\"", script );
signal( SIGCHLD, onSigCHLD );
if( !fork( ) )
{