engine: print to stderr if writing message to logfile failed
This commit is contained in:
parent
0a1269d52d
commit
9e28c98911
1 changed files with 11 additions and 3 deletions
|
@ -230,13 +230,20 @@ static void Sys_PrintLogfile( const int fd, const char *logtime, const char *msg
|
||||||
|
|
||||||
if( p == NULL )
|
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;
|
break;
|
||||||
}
|
}
|
||||||
else if( IsColorString( p ))
|
else if( IsColorString( p ))
|
||||||
{
|
{
|
||||||
if( p != msg )
|
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;
|
msg = p + 2;
|
||||||
|
|
||||||
if( colorize )
|
if( colorize )
|
||||||
|
@ -244,7 +251,8 @@ static void Sys_PrintLogfile( const int fd, const char *logtime, const char *msg
|
||||||
}
|
}
|
||||||
else
|
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;
|
msg = p + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue