summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2015-04-28 13:50:22 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2016-11-17 13:15:44 +0000
commitaafe0904ef60a2fb9660d3410180086565feef98 (patch)
tree9537e6b8c2a158d7c0b4abf330e9fd854c189ca6
parent0dd1ebe5089bf04be27bd4e616359061c77713c5 (diff)
Separate logfile name format and logfile name
If OsVendorFatalError is called before logfile name has been formatted g_pszLogFile still contains a %s. Use a separate g_pszLogFileFormat and g_pszLogFile, so g_pszLogFile is NULL until the logfile name has been generated. This makes g_fLogFileChanged obsolete, so remove it. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
-rw-r--r--hw/xwin/InitOutput.c9
-rw-r--r--hw/xwin/winglobals.c6
-rw-r--r--hw/xwin/winglobals.h4
-rw-r--r--hw/xwin/winprocarg.c3
4 files changed, 10 insertions, 12 deletions
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index e2b0a8772..3de8f6f81 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -616,13 +616,13 @@ winFixupPaths(void)
winMsg(X_ERROR, "Can not determine HOME directory\n");
}
}
- if (!g_fLogFileChanged) {
+ if (!g_fLogFile) {
static char buffer[MAX_PATH];
DWORD size = GetTempPath(sizeof(buffer), buffer);
if (size && size < sizeof(buffer)) {
snprintf(buffer + size, sizeof(buffer) - size,
- "XWin.%s.log", display);
+ g_pszLogFileFormat, display);
buffer[sizeof(buffer) - 1] = 0;
g_pszLogFile = buffer;
winMsg(X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
@@ -654,7 +654,10 @@ OsVendorInit(void)
#endif
if (serverGeneration == 1) {
- g_pszLogFile = LogInit(g_pszLogFile, ".old");
+ if (g_pszLogFile)
+ g_pszLogFile = LogInit(g_pszLogFile, ".old");
+ else
+ g_pszLogFile = LogInit(g_pszLogFileFormat, ".old");
/* Tell crashreporter logfile name */
xorg_crashreport_init(g_pszLogFile);
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 862b69f6a..8a699f236 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -63,11 +63,11 @@ HICON g_hIconX = NULL;
HICON g_hSmallIconX = NULL;
#ifndef RELOCATE_PROJECTROOT
-const char *g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
+const char *g_pszLogFileFormat = DEFAULT_LOGDIR "/XWin.%s.log";
#else
-const char *g_pszLogFile = "XWin.log";
-Bool g_fLogFileChanged = FALSE;
+const char *g_pszLogFileFormat = "XWin.%s.log";
#endif
+const char *g_pszLogFile = NULL;
int g_iLogVerbose = 2;
char *g_pszCommandLine = NULL;
Bool g_fSilentFatalError = FALSE;
diff --git a/hw/xwin/winglobals.h b/hw/xwin/winglobals.h
index b45d50753..a20f266c2 100644
--- a/hw/xwin/winglobals.h
+++ b/hw/xwin/winglobals.h
@@ -40,11 +40,9 @@ extern int g_iNumScreens;
extern int g_iLastScreen;
extern char *g_pszCommandLine;
extern Bool g_fSilentFatalError;
+extern const char *g_pszLogFileFormat;
extern const char *g_pszLogFile;
-#ifdef RELOCATE_PROJECTROOT
-extern Bool g_fLogFileChanged;
-#endif
extern int g_iLogVerbose;
extern Bool g_fAuthEnabled;
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index f6e62d3ad..fe5bfe230 100644
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -1018,9 +1018,6 @@ ddxProcessArgument(int argc, char *argv[], int i)
if (IS_OPTION("-logfile")) {
CHECK_ARGS(1);
g_pszLogFile = argv[++i];
-#ifdef RELOCATE_PROJECTROOT
- g_fLogFileChanged = TRUE;
-#endif
return 2;
}