summaryrefslogtreecommitdiff
path: root/src/sys_unix.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2011-01-24 14:27:42 +0300
committerAndrey Nazarov <skuller@skuller.net>2011-01-25 15:20:05 +0300
commit61f5a9dbc5fd27d84f82491f5074bae2fe50426e (patch)
tree44d836c383c184f5da808aad728bcb145ceaea91 /src/sys_unix.c
parent294375c4aafabfbb339ef75f7c6e7ee0d052b446 (diff)
Re-exec ‘autoexec.cfg’ after gamedir change.
Restrict ‘config.cfg’ and ‘autoexec.cfg’ to be real files within the game directory, don't search for them in packs. Split Cmd_Exec_f into Cmd_ExecuteFile utility function. Add more validity checks: oversize names, oversize files, exec loops. Make Sys_AddDefaultConfig omit the ‘Execing...’ line if the config file is empty.
Diffstat (limited to 'src/sys_unix.c')
-rw-r--r--src/sys_unix.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sys_unix.c b/src/sys_unix.c
index 769bebd..99354b2 100644
--- a/src/sys_unix.c
+++ b/src/sys_unix.c
@@ -570,8 +570,6 @@ void Sys_AddDefaultConfig( void ) {
}
if( fstat( fileno( fp ), &st ) == 0 ) {
- Com_Printf( "Execing " SYS_SITECFG_NAME "\n" );
-
len = st.st_size;
if( len >= cmd_buffer.maxsize ) {
len = cmd_buffer.maxsize - 1;
@@ -584,6 +582,11 @@ void Sys_AddDefaultConfig( void ) {
}
fclose( fp );
+
+ if( cmd_buffer.cursize ) {
+ Com_Printf( "Execing %s\n", SYS_SITECFG_NAME );
+ Cbuf_Execute( &cmd_buffer );
+ }
}
void Sys_Sleep( int msec ) {