From: Ivan Maidanski Date: Tue, 24 Jan 2012 04:22:01 +0000 (+0400) Subject: Recognize GC_LOG_TO_FILE_ALWAYS macro to log to 'gc.log' by default X-Git-Tag: gc7_3alpha2~189 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dce915e3ee6b408049f905b917af7711d388c08c;p=gc Recognize GC_LOG_TO_FILE_ALWAYS macro to log to 'gc.log' by default * 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). --- diff --git a/misc.c b/misc.c index b4bea7a8..3cc29b6b 100644 --- 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);