fix mandatory client logfile
The logfile can't be created before the commandline arguments are parsed, because before that, the home directory is unknown. This patch logs into a memory buffer which is then copied to the logfile as soon as the logfile is created after processing the commandline arguments. The memory buffer is created during the initialisation of global variables, and destroyed after the logfile is created.
This commit is contained in:
@@ -95,6 +95,7 @@ COMMANDN(toggleconsole, toggleconsole, "");
|
||||
void renderconsole() { con.render(); }
|
||||
|
||||
stream *clientlogfile = NULL;
|
||||
vector<char> *bootclientlog = new vector<char>;
|
||||
int clientloglinesremaining = INT_MAX;
|
||||
|
||||
void clientlogf(const char *s, ...)
|
||||
@@ -113,6 +114,7 @@ void clientlogf(const char *s, ...)
|
||||
clientlogfile->printf("%s%s\n", ts, l);
|
||||
if(--clientloglinesremaining <= 0) DELETEP(clientlogfile);
|
||||
}
|
||||
else if(bootclientlog) cvecprintf(*bootclientlog, "%s%s\n", ts, l);
|
||||
l = p + 1;
|
||||
}
|
||||
while(p);
|
||||
|
||||
Reference in New Issue
Block a user