]> granicus.if.org Git - gc/commitdiff
Recognize GC_LOG_TO_FILE_ALWAYS macro to log to 'gc.log' by default
authorIvan Maidanski <ivmai@mail.ru>
Tue, 24 Jan 2012 04:22:01 +0000 (08:22 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 24 Jan 2012 12:46:54 +0000 (16:46 +0400)
* misc.c (GC_init): If "GC_LOG_FILE" environment variable is unset and
GC_LOG_TO_FILE_ALWAYS macro defined then open "gc.log" file for GC
logging (only Unix and Cygwin).

misc.c

diff --git a/misc.c b/misc.c
index b4bea7a8787b3b13c957323d03cf212962f89f0e..3cc29b6bb58e3e902bc5aa5b252b9532edeacb5c 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -744,7 +744,13 @@ GC_API void GC_CALL GC_init(void)
 #     if defined(UNIX_LIKE) || defined(CYGWIN32)
         {
           char * file_name = GETENV("GC_LOG_FILE");
-          if (0 != file_name) {
+#         ifdef GC_LOG_TO_FILE_ALWAYS
+            if (NULL == file_name)
+              file_name = "gc.log";
+#         else
+            if (0 != file_name)
+#         endif
+          {
             int log_d = open(file_name, O_CREAT|O_WRONLY|O_APPEND, 0666);
             if (log_d < 0) {
               GC_err_printf("Failed to open %s as log file\n", file_name);