diff options
author | Andrey Nazarov <skuller@skuller.net> | 2009-01-30 22:12:09 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2009-01-30 22:12:09 +0000 |
commit | 5dea48daf494adbf28c75cb74e478e5bc15fbff4 (patch) | |
tree | 80a643dded46deb495df1336deee2d69bf4f9f7e /source/sys_unix.c | |
parent | 37020390b06ab9cdf491e450f04f5f72ac8df93a (diff) |
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.
Diffstat (limited to 'source/sys_unix.c')
-rw-r--r-- | source/sys_unix.c | 26 |
1 files changed, 18 insertions, 8 deletions
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 ); |