(trunk libT) #3764 "script-torrent-done shouldn't block libtransmission" -- handle zombie processes.
This commit is contained in:
parent
9a5a429761
commit
f1e236693d
|
@ -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( ) )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue