From 5dea48daf494adbf28c75cb74e478e5bc15fbff4 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Fri, 30 Jan 2009 22:12:09 +0000 Subject: Client now works around the fact R1Q2 servers always report the highest protocol number they support in svc_serverdata message, regardless of the actual protocol version being used. Be silent and try to preserve reliable data at least when client demo message overflows, do not dump entire message. Use playerstate coordinates for positioning player's own entity in case it is invisible regardless of server protocol version. Changed ‘map_allsolid_bug’ default to 0, since it seems to break some mods. Implemented ‘recycle’ command for dedicated servers. Correctly parse comments from ‘/etc/default/q2pro’ config file. Install SIGHUP handler when running dedicated server only. It can now be used to reopen server logfile for rotation. Allow ${arg1-arg2} syntax when expanding alias parameters. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/sys_unix.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'source/sys_unix.c') diff --git a/source/sys_unix.c b/source/sys_unix.c index f5e1aa9..66102eb 100644 --- a/source/sys_unix.c +++ b/source/sys_unix.c @@ -594,7 +594,7 @@ char *Sys_GetCurrentDirectory( void ) { void Sys_AddDefaultConfig( void ) { FILE *fp; struct stat st; - char *text; + size_t len, r; fp = fopen( SYS_SITECFG_NAME, "r" ); if( !fp ) { @@ -602,11 +602,17 @@ void Sys_AddDefaultConfig( void ) { } if( fstat( fileno( fp ), &st ) == 0 ) { - text = Cbuf_Alloc( &cmd_buffer, st.st_size ); - if( text ) { - Com_Printf( "Execing " SYS_SITECFG_NAME "\n" ); - fread( text, st.st_size, 1, fp ); + Com_Printf( "Execing " SYS_SITECFG_NAME "\n" ); + + len = st.st_size; + if( len >= cmd_buffer.maxsize ) { + len = cmd_buffer.maxsize - 1; } + + r = fread( cmd_buffer.text, 1, len, fp ); + cmd_buffer.text[r] = 0; + + cmd_buffer.cursize = COM_Compress( cmd_buffer.text ); } fclose( fp ); @@ -648,13 +654,17 @@ void Sys_FixFPCW( void ) { #endif } +static void hup_handler( int signum ) { + Com_FlushLogs(); +} + static void term_handler( int signum ) { #ifdef _GNU_SOURCE Com_Printf( "%s\n", strsignal( signum ) ); #else Com_Printf( "Received signal %d, exiting\n", signum ); #endif - Com_Quit( NULL ); + Com_Quit( NULL, KILL_DROP ); } static void kill_handler( int signum ) { @@ -726,8 +736,8 @@ void Sys_Init( void ) { signal( SIGHUP, term_handler ); } else #endif - { - signal( SIGHUP, SIG_IGN ); + if( Com_IsDedicated() ) { + signal( SIGHUP, hup_handler ); } sys_parachute = Cvar_Get( "sys_parachute", "1", CVAR_NOSET ); -- cgit v1.2.3