diff options
Diffstat (limited to 'src/sys/sys_main.c')
-rw-r--r-- | src/sys/sys_main.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/sys/sys_main.c b/src/sys/sys_main.c index 170107ae..bfec88eb 100644 --- a/src/sys/sys_main.c +++ b/src/sys/sys_main.c @@ -141,7 +141,12 @@ Sys_PIDFileName */ static char *Sys_PIDFileName( void ) { - return va( "%s/%s", Sys_DefaultHomePath( ), PID_FILENAME ); + const char *homePath = Sys_DefaultHomePath( ); + + if( *homePath != NULL ) + return va( "%s/%s", Sys_DefaultHomePath( ), PID_FILENAME ); + + return NULL; } /* @@ -157,6 +162,9 @@ qboolean Sys_WritePIDFile( void ) FILE *f; qboolean stale = qfalse; + if( pidFile == NULL ) + return qfalse; + // First, check if the pid file is already there if( ( f = fopen( pidFile, "r" ) ) != NULL ) { @@ -205,7 +213,10 @@ static __attribute__ ((noreturn)) void Sys_Exit( int exitCode ) if( exitCode < 2 ) { // Normal exit - remove( Sys_PIDFileName( ) ); + char *pidFile = Sys_PIDFileName( ); + + if( pidFile != NULL ) + remove( pidFile ); } Sys_PlatformExit( ); |