From 255c3c0e8ca0f402b2c327d70c8a254ba65eda03 Mon Sep 17 00:00:00 2001 From: Alexander Gottwald Date: Mon, 22 Nov 2004 14:12:33 +0000 Subject: [PATCH] Xming: Place logfile in users tempdir --- hw/xwin/ChangeLog | 5 +++++ hw/xwin/InitOutput.c | 26 +++++++++++++++++++------- hw/xwin/winglobals.c | 1 + hw/xwin/winprocarg.c | 6 ++++++ 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog index 78ff09cbb..84dc1d3ed 100644 --- a/hw/xwin/ChangeLog +++ b/hw/xwin/ChangeLog @@ -1,3 +1,8 @@ +2004-11-22 Alexander Gottwald + + * InitOutput.c, winglobals.c, winprocarg.c: + Xming: Place logfile in users tempdir + 2004-11-15 Alexander Gottwald * Imakefile: diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index ad668720c..a6865c2ce 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -54,6 +54,7 @@ extern char * g_pszCommandLine; extern Bool g_fSilentFatalError; extern char * g_pszLogFile; +extern Bool g_fLogFileChanged; extern int g_iLogVerbose; Bool g_fLogInited; @@ -604,7 +605,6 @@ winFixupPaths (void) basedir); buffer[sizeof(buffer)-1] = 0; putenv(buffer); - winDebug("%s\n", getenv("XKEYSYMDB")); } if (getenv("XLOCALEDIR") == NULL) { @@ -613,7 +613,18 @@ winFixupPaths (void) basedir); buffer[sizeof(buffer)-1] = 0; putenv(buffer); - winDebug("%s\n", getenv("XLOCALEDIR")); + } + if (!g_fLogFileChanged) { + 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); + buffer[sizeof(buffer)-1] = 0; + g_pszLogFile = buffer; + winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile); + } } #ifdef XKB { @@ -634,6 +645,11 @@ OsVendorInit (void) /* Re-initialize global variables on server reset */ winInitializeGlobals (); + LogInit (NULL, NULL); + LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose); + + winFixupPaths(); + #ifdef DDXOSVERRORF if (!OsVendorVErrorFProc) OsVendorVErrorFProc = OsVendorVErrorF; @@ -647,7 +663,7 @@ OsVendorInit (void) */ g_fLogInited = TRUE; LogInit (g_pszLogFile, NULL); - } + } LogSetParameter (XLOG_FLUSH, 1); LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose); LogSetParameter (XLOG_FILE_VERBOSITY, 1); @@ -681,10 +697,6 @@ OsVendorInit (void) /* We have to flag this as an explicit screen, even though it isn't */ g_ScreenInfo[0].fExplicitScreen = TRUE; } - - winFixupPaths(); - - XSupportsLocale(); } diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index 0dc1af81e..53fc02fa5 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -61,6 +61,7 @@ HICON g_hSmallIconX = NULL; char * g_pszLogFile = "/tmp/XWin.log"; #else char * g_pszLogFile = "XWin.log"; +Bool g_fLogFileChanged = FALSE; #endif int g_iLogVerbose = 2; Bool g_fLogInited = FALSE; diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 7a1caf9e9..11dcc525e 100755 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -45,6 +45,9 @@ extern Bool g_fClipboard; #endif extern int g_iLogVerbose; extern char * g_pszLogFile; +#ifdef RELOCATE_PROJECTROOT +extern Bool g_fLogFileChanged; +#endif extern Bool g_fXdmcpEnabled; extern char * g_pszCommandLine; extern Bool g_fKeyboardHookLL; @@ -1177,6 +1180,9 @@ ddxProcessArgument (int argc, char *argv[], int i) { CHECK_ARGS (1); g_pszLogFile = argv[++i]; +#ifdef RELOCATE_PROJECTROOT + g_fLogFileChanged = TRUE; +#endif return 2; }