mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 05:52:03 +00:00
Don't allow qagame module to create "botlib.log" at ANY filesystem location
This commit is contained in:
parent
7166a3cd39
commit
f3bdd6f022
2 changed files with 5 additions and 21 deletions
|
@ -144,26 +144,7 @@ int Export_BotLibSetup(void)
|
|||
|
||||
if(botDeveloper)
|
||||
{
|
||||
char *homedir, *gamedir, *basegame;
|
||||
char logfilename[MAX_OSPATH];
|
||||
|
||||
homedir = LibVarGetString("homedir");
|
||||
gamedir = LibVarGetString("gamedir");
|
||||
basegame = LibVarGetString("basegame");
|
||||
|
||||
if (*homedir)
|
||||
{
|
||||
if(*gamedir)
|
||||
Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, gamedir, PATH_SEP);
|
||||
else if(*basegame)
|
||||
Com_sprintf(logfilename, sizeof(logfilename), "%s%c%s%cbotlib.log", homedir, PATH_SEP, basegame, PATH_SEP);
|
||||
else
|
||||
Com_sprintf(logfilename, sizeof(logfilename), "%s%c" BASEGAME "%cbotlib.log", homedir, PATH_SEP, PATH_SEP);
|
||||
}
|
||||
else
|
||||
Com_sprintf(logfilename, sizeof(logfilename), "botlib.log");
|
||||
|
||||
Log_Open(logfilename);
|
||||
Log_Open("botlib.log");
|
||||
}
|
||||
|
||||
botimport.Print(PRT_MESSAGE, "------- BotLib Initialization -------\n");
|
||||
|
|
|
@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include <string.h>
|
||||
|
||||
#include "../qcommon/q_shared.h"
|
||||
#include "../qcommon/qcommon.h"
|
||||
#include "botlib.h"
|
||||
#include "be_interface.h" //for botimport.Print
|
||||
#include "l_libvar.h"
|
||||
|
@ -58,6 +59,7 @@ static logfile_t logfile;
|
|||
//===========================================================================
|
||||
void Log_Open(char *filename)
|
||||
{
|
||||
char *ospath;
|
||||
if (!LibVarValue("log", "0")) return;
|
||||
if (!filename || !strlen(filename))
|
||||
{
|
||||
|
@ -69,7 +71,8 @@ void Log_Open(char *filename)
|
|||
botimport.Print(PRT_ERROR, "log file %s is already opened\n", logfile.filename);
|
||||
return;
|
||||
} //end if
|
||||
logfile.fp = fopen(filename, "wb");
|
||||
ospath = FS_BuildOSPath(Cvar_VariableString("fs_homepath"), "", filename);
|
||||
logfile.fp = fopen(ospath, "wb");
|
||||
if (!logfile.fp)
|
||||
{
|
||||
botimport.Print(PRT_ERROR, "can't open the log file %s\n", filename);
|
||||
|
|
Loading…
Reference in a new issue