From 41fb38eb09e338d76e63cb8b6a2ac7e2505e5c72 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 23 Oct 2001 16:32:44 +0000 Subject: If the fopen() fails (eg, because evolution-mail was started by oafd with * mail-mt.c (mail_msg_new): If the fopen() fails (eg, because evolution-mail was started by oafd with PWD=/), don't try to use the NULL file handle. svn path=/trunk/; revision=13943 --- mail/ChangeLog | 6 ++++++ mail/mail-mt.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index f4745073ea..3521f4d313 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-10-23 Dan Winship + + * mail-mt.c (mail_msg_new): If the fopen() fails (eg, because + evolution-mail was started by oafd with PWD=/), don't try to use + the NULL file handle. + 2001-10-23 * mail-session.c (get_password): Completely re-done. We now hae a diff --git a/mail/mail-mt.c b/mail/mail-mt.c index ab240d595f..af3eb5c5f2 100644 --- a/mail/mail-mt.c +++ b/mail/mail-mt.c @@ -95,8 +95,14 @@ void *mail_msg_new(mail_msg_op_t *ops, EMsgPort *reply_port, size_t size) log_ops = getenv("EVOLUTION_MAIL_LOG_OPS") != NULL; log_locks = getenv("EVOLUTION_MAIL_LOG_LOCKS") != NULL; log = fopen("evolution-mail-ops.log", "w+"); - setvbuf(log, NULL, _IOLBF, 0); - fprintf(log, "Started evolution-mail: %s\n", ctime(&now)); + 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"); @@ -107,7 +113,6 @@ void *mail_msg_new(mail_msg_op_t *ops, EMsgPort *reply_port, size_t size) fprintf(log, "%ld: lock mail_msg_lock\n", pthread_self()); } #endif - g_warning("Logging mail operations to evolution-mail-ops.log"); } #endif msg = g_malloc0(size); -- cgit