From 1651eba931c6cc80e9a5bd24dcbb591ae9e1163b Mon Sep 17 00:00:00 2001 From: 3 Date: Tue, 23 Oct 2001 17:11:33 +0000 Subject: Added missing errno.h (mail_msg_new): Fix the logic a bit, dont try to 2001-10-23 * mail-mt.c: Added missing errno.h (mail_msg_new): Fix the logic a bit, dont try to open the log file unless logging is actually requested. svn path=/trunk/; revision=13944 --- mail/ChangeLog | 6 ++++++ mail/mail-mt.c | 37 +++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 3521f4d313..1cc274500b 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-10-23 + + * mail-mt.c: Added missing errno.h + (mail_msg_new): Fix the logic a bit, dont try to open the log file + unless logging is actually requested. + 2001-10-23 Dan Winship * mail-mt.c (mail_msg_new): If the fopen() fails (eg, because diff --git a/mail/mail-mt.c b/mail/mail-mt.c index af3eb5c5f2..3f45617b84 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -94,25 +95,25 @@ void *mail_msg_new(mail_msg_op_t *ops, EMsgPort *reply_port, size_t size) log_init = TRUE; log_ops = getenv("EVOLUTION_MAIL_LOG_OPS") != NULL; log_locks = getenv("EVOLUTION_MAIL_LOG_LOCKS") != NULL; - log = fopen("evolution-mail-ops.log", "w+"); - if (log) { - setvbuf(log, NULL, _IOLBF, 0); - fprintf(log, "Started evolution-mail: %s\n", ctime(&now)); - g_warning("Logging mail operations to evolution-mail-ops.log"); - } else { - g_warning ("Could not open log file: %s", g_strerror (errno)); - log_ops = log_locks = FALSE; - } -#ifdef LOG_OPS - if (log_ops) - fprintf(log, "Logging async operations\n"); -#endif -#ifdef LOG_LOCKS - if (log_locks) { - fprintf(log, "Logging lock operations, mail_gui_thread = %ld\n\n", mail_gui_thread); - fprintf(log, "%ld: lock mail_msg_lock\n", pthread_self()); + if (log_ops || log_locks) { + log = fopen("evolution-mail-ops.log", "w+"); + if (log) { + setvbuf(log, NULL, _IOLBF, 0); + fprintf(log, "Started evolution-mail: %s\n", ctime(&now)); + g_warning("Logging mail operations to evolution-mail-ops.log"); + + if (log_ops) + fprintf(log, "Logging async operations\n"); + + if (log_locks) { + fprintf(log, "Logging lock operations, mail_gui_thread = %ld\n\n", mail_gui_thread); + fprintf(log, "%ld: lock mail_msg_lock\n", pthread_self()); + } + } else { + g_warning ("Could not open log file: %s", strerror(errno)); + log_ops = log_locks = FALSE; + } } -#endif } #endif msg = g_malloc0(size); -- cgit v1.2.3