summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/sys_main.c15
-rw-r--r--src/sys/sys_unix.c2
2 files changed, 14 insertions, 3 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( );
diff --git a/src/sys/sys_unix.c b/src/sys/sys_unix.c
index 53a86354..b05cf855 100644
--- a/src/sys/sys_unix.c
+++ b/src/sys/sys_unix.c
@@ -54,7 +54,7 @@ char *Sys_DefaultHomePath(void)
{
char *p;
- if( !*homePath )
+ if( !*homePath && com_homepath != NULL )
{
if( ( p = getenv( "HOME" ) ) != NULL )
{