summaryrefslogtreecommitdiff
path: root/src/sys/sys_main.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2012-07-07 17:32:19 +0000
committerTim Angus <tim@ngus.net>2013-01-12 20:46:31 +0000
commit0f1b59fc0585e79306eb5beb28822cb5e12a57dc (patch)
tree0e99e8d00c5a63588ec588bdf6f85f5cc24aa217 /src/sys/sys_main.c
parent8481cc3ac152bcda93507461606ce0e569958fd0 (diff)
* (bug #5709) Fix crash when invoked with --version
Diffstat (limited to 'src/sys/sys_main.c')
-rw-r--r--src/sys/sys_main.c15
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( );