mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 04:18:39 +00:00
Properly protect pidfile creation and deletion with the lockfile.
This commit is contained in:
@@ -85,14 +85,16 @@ main( int argc, char ** argv )
|
||||
errsyslog( 1 );
|
||||
}
|
||||
|
||||
if( NULL != pidfile && 0 > savepid( pidfile ) )
|
||||
exit( 1 );
|
||||
atexit( exitcleanup );
|
||||
sockfd = trylocksock( sockpath );
|
||||
if( 0 > sockfd )
|
||||
{
|
||||
exit( 1 );
|
||||
}
|
||||
if( NULL != pidfile && 0 > savepid( pidfile ) )
|
||||
{
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
evbase = event_init();
|
||||
setupsigs( evbase );
|
||||
@@ -299,15 +301,15 @@ exitcleanup( void )
|
||||
unlink( gl_sockpath );
|
||||
close( gl_sockfd );
|
||||
}
|
||||
if( 0 != gl_pidfile[0] )
|
||||
{
|
||||
unlink( gl_pidfile );
|
||||
}
|
||||
if( 0 <= gl_lockfd )
|
||||
{
|
||||
unlink( gl_lockpath );
|
||||
close( gl_lockfd );
|
||||
}
|
||||
if( 0 != gl_pidfile[0] )
|
||||
{
|
||||
unlink( gl_pidfile );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user