diff options
author | Andrey Nazarov <skuller@skuller.net> | 2008-08-27 13:17:26 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2008-08-27 13:17:26 +0000 |
commit | be7d316905ec18c63f03f7b870bae852f1fa93aa (patch) | |
tree | 28e27dc48465c813517044ca928fc0d60caf6a23 /source/common.c | |
parent | fa217fd855c6b5ee1ecff2ff3249f78a2f3f109f (diff) |
Don't crash the server when PF_cprintf is called for a free/zombie client,
print a warning instead.
Added `com_fatal_error' cvar which makes otherwise non-fatal errors fatal
and causes application exits (useful for dedicated servers).
Diffstat (limited to 'source/common.c')
-rw-r--r-- | source/common.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/common.c b/source/common.c index d1f3109..0dc03b4 100644 --- a/source/common.c +++ b/source/common.c @@ -62,6 +62,7 @@ cvar_t *com_timedemo; cvar_t *com_date_format; cvar_t *com_time_format; cvar_t *com_debug_break; +cvar_t *com_fatal_error; fileHandle_t com_logFile; qboolean com_logNewline; @@ -373,9 +374,10 @@ void Com_Error( comErrorType_t code, const char *fmt, ... ) { Q_vsnprintf( com_errorMsg, sizeof( com_errorMsg ), fmt, argptr ); va_end( argptr ); - /* fix up drity message buffers */ - MSG_Init(); + // fix up drity message buffers + MSG_Init(); + // abort any console redirects Com_AbortRedirect(); if( code == ERR_DISCONNECT || code == ERR_SILENT ) { @@ -391,6 +393,11 @@ void Com_Error( comErrorType_t code, const char *fmt, ... ) { Sys_DebugBreak(); } + // make otherwise non-fatal errors fatal + if( com_fatal_error && com_fatal_error->integer ) { + code = ERR_FATAL; + } + if( code == ERR_DROP ) { Com_Printf( S_COLOR_RED "********************\n" "ERROR: %s\n" @@ -1304,6 +1311,7 @@ void Qcommon_Init( int argc, char **argv ) { com_time_format = Cvar_Get( "com_time_format", "%H:%M", 0 ); #endif com_debug_break = Cvar_Get( "com_debug_break", "0", 0 ); + com_fatal_error = Cvar_Get( "com_fatal_error", "0", 0 ); com_version = Cvar_Get( "version", version, CVAR_SERVERINFO|CVAR_ROM ); Cmd_AddCommand ("z_stats", Z_Stats_f); |