2009-10-07 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Wed, 7 Oct 2009 12:22:07 +0000 (12:22 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:49 +0000 (21:06 +0400)
* doc/README.win32: Replace ".exe.log" to ".gc.log".
* doc/README.win64: Ditto.
* doc/README.win64: Fix a typo.
* misc.c (GC_CreateLogFile): Strip executable file extension for
the log file; use ".gc.log" extension (instead of ".log").

ChangeLog
doc/README.win32
doc/README.win64
misc.c

index 608e05b..eb5a59a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-10-07  Ivan Maidanski <ivmai@mail.ru>
 
+       * doc/README.win32: Replace ".exe.log" to ".gc.log".
+       * doc/README.win64: Ditto.
+       * doc/README.win64: Fix a typo.
+       * misc.c (GC_CreateLogFile): Strip executable file extension for
+       the log file; use ".gc.log" extension (instead of ".log").
+
+2009-10-07  Ivan Maidanski <ivmai@mail.ru>
+
        * include/gc_config_macros.h: Avoid the redefinition of
        GC_xxx_THREADS macros.
 
index e3bd655..47699e1 100644 (file)
@@ -7,7 +7,7 @@ broken in the meantime.  Patches are appreciated.
 For historical reasons,
 the collector test program "gctest" is linked as a GUI application,
 but does not open any windows.  Its output normally appears in the file
-"gctest.exe.log".  It may be started from the file manager.  The hour glass
+"gctest.gc.log".  It may be started from the file manager.  The hour glass
 cursor may appear as long as it's running.  If it is started from the
 command line, it will usually run in the background.  Wait a few
 minutes (a few seconds on a modern machine) before you check the output.
index 46dba46..416f034 100644 (file)
@@ -6,9 +6,9 @@ More testing would clearly be helpful.
 NT_X64_STATIC_THREADS_MAKEFILE has been used in
 this environment.  Copy this file to MAKEFILE, and then type "nmake"
 in a Visual C++ command line window to build the static library
-and the usual test programs.  To verify that the colllector is
+and the usual test programs.  To verify that the collector is
 at least somewhat functional, run gctest.exe.  This should create
-gctest.exe.log after a few seconds.
+gctest.gc.log after a few seconds.
 
 This process is completely analogous to NT_STATIC_THREADS_MAKEFILE
 for the 32-bit version.
diff --git a/misc.c b/misc.c
index 440c49b..eab3e2d 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -953,7 +953,7 @@ out:
   STATIC HANDLE GC_CreateLogFile(void)
   {
 #   if !defined(NO_GETENV) || !defined(OLD_WIN32_LOG_FILE)
-      TCHAR logPath[_MAX_PATH + sizeof(".log")];
+      TCHAR logPath[_MAX_PATH + 0x10]; /* buffer for path + ext */
 #   endif
     /* Use GetEnvironmentVariable instead of GETENV() for unicode support. */
 #   ifndef NO_GETENV
@@ -967,10 +967,14 @@ out:
                           NULL /* lpSecurityAttributes */, CREATE_ALWAYS,
                           FILE_FLAG_WRITE_THROUGH, NULL /* hTemplateFile */);
 #     else
+        int len = (int)GetModuleFileName(NULL /* hModule */, logPath,
+                                         _MAX_PATH + 1);
+        /* If GetModuleFileName() has failed then len is 0. */
+        if (len > 4 && logPath[len - 4] == (TCHAR)'.') {
+          len -= 4; /* strip executable file extension */
+        }
         /* strcat/wcscat() are deprecated on WinCE, so use memcpy()     */
-        memcpy(&logPath[GetModuleFileName(NULL /* hModule */, logPath,
-                                          _MAX_PATH + 1)],
-               TEXT(".log"), sizeof(TEXT(".log")));
+        memcpy(&logPath[len], TEXT(".gc.log"), sizeof(TEXT(".gc.log")));
 #     endif
     }
 #   if !defined(NO_GETENV) || !defined(OLD_WIN32_LOG_FILE)