2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2025-01-13 12:05:32 +01:00

engine: print to stderr if writing message to logfile failed

This commit is contained in:
Alibek Omarov 2024-09-30 03:24:39 +03:00
parent 0a1269d52d
commit 9e28c98911

View File

@ -230,13 +230,20 @@ static void Sys_PrintLogfile( const int fd, const char *logtime, const char *msg
if( p == NULL )
{
write( fd, msg, Q_strlen( msg ));
if( write( fd, msg, Q_strlen( msg )) < 0 )
{
// don't call engine Msg, might cause recursion
fprintf( stderr, "%s: write failed: %s\n", __func__, strerror( errno ));
}
break;
}
else if( IsColorString( p ))
{
if( p != msg )
write( fd, msg, p - msg );
{
if( write( fd, msg, p - msg ) < 0 )
fprintf( stderr, "%s: write failed: %s\n", __func__, strerror( errno ));
}
msg = p + 2;
if( colorize )
@ -244,7 +251,8 @@ static void Sys_PrintLogfile( const int fd, const char *logtime, const char *msg
}
else
{
write( fd, msg, p - msg + 1 );
if( write( fd, msg, p - msg + 1 ) < 0 )
fprintf( stderr, "%s: write failed: %s\n", __func__, strerror( errno ));
msg = p + 1;
}
}