summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>2010-02-01 17:11:51 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2010-03-16 14:02:17 +0000
commitbf181915e103b0659c5a0bc3b2f6bccb18c9ec36 (patch)
tree97baaa289584be87ffc5f438d3e2c58896d19d1b
parentcca4952d750779a4c58a11fe08a53336042930bb (diff)
Cygwin/X: Allow the default log location to be configurable
Allow the default log location to be configurable (e.g. /var/log), and use separate logs for each display instance (e.g. XWin.0.log). Make the type of g_pszLogFile const char*, per os/log.c:LogInit(). Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
-rw-r--r--configure.ac1
-rw-r--r--hw/xwin/InitOutput.c17
-rw-r--r--hw/xwin/winerror.c9
-rw-r--r--hw/xwin/winglobals.c4
-rwxr-xr-xhw/xwin/winprocarg.c2
-rw-r--r--hw/xwin/winshaddd.c2
-rw-r--r--include/xwin-config.h.in2
7 files changed, 22 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index 3e8ea10d5..065016f29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1829,6 +1829,7 @@ AC_MSG_RESULT([$XWIN])
if test "x$XWIN" = xyes; then
PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
+ AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
AC_CHECK_TOOL(WINDRES, windres)
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index d8fd59f6c..175cd9d81 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -69,7 +69,7 @@ extern int g_iLastScreen;
extern char * g_pszCommandLine;
extern Bool g_fSilentFatalError;
-extern char * g_pszLogFile;
+extern const char * g_pszLogFile;
extern Bool g_fLogFileChanged;
extern int g_iLogVerbose;
Bool g_fLogInited;
@@ -244,7 +244,7 @@ ddxGiveUp (void)
#endif
if (!g_fLogInited) {
- LogInit (g_pszLogFile, NULL);
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
g_fLogInited = TRUE;
}
LogClose ();
@@ -689,9 +689,6 @@ OsVendorInit (void)
/* Re-initialize global variables on server reset */
winInitializeGlobals ();
- LogInit (NULL, NULL);
- LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
-
winFixupPaths();
#ifdef DDXOSVERRORF
@@ -706,7 +703,7 @@ OsVendorInit (void)
* avoid the second call
*/
g_fLogInited = TRUE;
- LogInit (g_pszLogFile, NULL);
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
}
LogSetParameter (XLOG_FLUSH, 1);
LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
@@ -927,7 +924,7 @@ ddxUseMsg(void)
/* Log file will not be opened for UseMsg unless we open it now */
if (!g_fLogInited) {
- LogInit (g_pszLogFile, NULL);
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
g_fLogInited = TRUE;
}
LogClose ();
@@ -935,9 +932,9 @@ ddxUseMsg(void)
/* Notify user where UseMsg text can be found.*/
if (!g_fNoHelpMessageBox)
winMessageBoxF ("The " PROJECT_NAME " help text has been printed to "
- "/tmp/XWin.log.\n"
- "Please open /tmp/XWin.log to read the help text.\n",
- MB_ICONINFORMATION);
+ "%s.\n"
+ "Please open %s to read the help text.\n",
+ MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile);
}
/* See Porting Layer Definition - p. 20 */
diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c
index 9ed27c3d0..191b9a921 100644
--- a/hw/xwin/winerror.c
+++ b/hw/xwin/winerror.c
@@ -41,8 +41,9 @@
/* References to external symbols */
extern char * g_pszCommandLine;
-extern char * g_pszLogFile;
+extern const char * g_pszLogFile;
extern Bool g_fSilentFatalError;
+extern Bool g_fLogInited;
#ifdef DDXOSVERRORF
@@ -87,6 +88,12 @@ OsVendorFatalError (void)
if (g_fSilentFatalError)
return;
+ if (!g_fLogInited) {
+ g_fLogInited = TRUE;
+ g_pszLogFile = LogInit (g_pszLogFile, NULL);
+ }
+ LogClose ();
+
winMessageBoxF (
"A fatal error has occurred and " PROJECT_NAME " will now exit.\n" \
"Please open %s for more information.\n",
diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c
index 7bb4a602d..926ce69b8 100644
--- a/hw/xwin/winglobals.c
+++ b/hw/xwin/winglobals.c
@@ -69,9 +69,9 @@ Bool g_fAuthEnabled = FALSE;
HICON g_hIconX = NULL;
HICON g_hSmallIconX = NULL;
#ifndef RELOCATE_PROJECTROOT
-char * g_pszLogFile = "/tmp/XWin.log";
+const char * g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
#else
-char * g_pszLogFile = "XWin.log";
+const char * g_pszLogFile = "XWin.log";
Bool g_fLogFileChanged = FALSE;
#endif
int g_iLogVerbose = 2;
diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c
index 159e53333..66da76f6c 100755
--- a/hw/xwin/winprocarg.c
+++ b/hw/xwin/winprocarg.c
@@ -53,7 +53,7 @@ extern Bool g_fUnicodeClipboard;
extern Bool g_fClipboard;
#endif
extern int g_iLogVerbose;
-extern char * g_pszLogFile;
+extern const char * g_pszLogFile;
#ifdef RELOCATE_PROJECTROOT
extern Bool g_fLogFileChanged;
#endif
diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c
index 4f3e89501..85dc10f53 100644
--- a/hw/xwin/winshaddd.c
+++ b/hw/xwin/winshaddd.c
@@ -42,7 +42,7 @@
*/
extern HWND g_hDlgExit;
-extern char *g_pszLogFile;
+extern const char *g_pszLogFile;
/*
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,
diff --git a/include/xwin-config.h.in b/include/xwin-config.h.in
index 21ceb29cf..13b51ca7f 100644
--- a/include/xwin-config.h.in
+++ b/include/xwin-config.h.in
@@ -32,3 +32,5 @@
/* Location of system.XWinrc */
#undef SYSCONFDIR
+/* Default log location */
+#undef DEFAULT_LOGDIR