mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: make Sys_LogFileNo return -1 when log file isn't opened
This commit is contained in:
@@ -61,6 +61,8 @@ SYSTEM LOG
|
||||
*/
|
||||
int Sys_LogFileNo( void )
|
||||
{
|
||||
if( !s_ld.logfile )
|
||||
return -1;
|
||||
return s_ld.logfileno;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,11 @@ static void Sys_AppendPrint( struct print_data *pd, const char *fmt, ... )
|
||||
{
|
||||
char ch = '\n';
|
||||
|
||||
write( pd->logfd, pd->message, len );
|
||||
write( pd->logfd, &ch, 1 );
|
||||
if( pd->logfd >= 0 )
|
||||
{
|
||||
write( pd->logfd, pd->message, len );
|
||||
write( pd->logfd, &ch, 1 );
|
||||
}
|
||||
|
||||
write( STDERR_FILENO, pd->message, len );
|
||||
write( STDERR_FILENO, &ch, 1 );
|
||||
|
||||
@@ -44,7 +44,8 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context )
|
||||
|
||||
// now get log fd and write trace directly to log
|
||||
logfd = Sys_LogFileNo();
|
||||
write( logfd, message, len );
|
||||
if( logfd >= 0 )
|
||||
write( logfd, message, len );
|
||||
|
||||
#if HAVE_LIBBACKTRACE
|
||||
if( have_libbacktrace && !detailed_message )
|
||||
|
||||
Reference in New Issue
Block a user