dovecot-1.2: deliver: If we're dying because we can't write to l...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 29 09:59:04 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/6665a641780c
changeset: 8118:6665a641780c
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 29 09:58:54 2008 +0300
description:
deliver: If we're dying because we can't write to log file, write error to stderr.

diffstat:

1 file changed, 15 insertions(+), 5 deletions(-)
src/deliver/deliver.c |   20 +++++++++++++++-----

diffs (36 lines):

diff -r 079ed76a987d -r 6665a641780c src/deliver/deliver.c
--- a/src/deliver/deliver.c	Fri Aug 29 09:43:18 2008 +0300
+++ b/src/deliver/deliver.c	Fri Aug 29 09:58:54 2008 +0300
@@ -639,17 +639,27 @@ static struct istream *create_raw_stream
 
 static void failure_exit_callback(int *status)
 {
-	/* we want all our exit codes to be sysexits.h compatible */
+	/* we want all our exit codes to be sysexits.h compatible.
+	   if we failed because of a logging related error, we most likely
+	   aren't writing to stderr, so try writing there to give some kind of
+	   a clue what's wrong. FATAL_LOGOPEN failure already wrote to
+	   stderr, so don't duplicate it. */
 	switch (*status) {
+	case FATAL_LOGWRITE:
+		fputs("Failed to write to log file", stderr);
+		break;
+	case FATAL_LOGERROR:
+		fputs("Internal logging error", stderr);
+		break;
 	case FATAL_LOGOPEN:
-	case FATAL_LOGWRITE:
-	case FATAL_LOGERROR:
 	case FATAL_OUTOFMEM:
 	case FATAL_EXEC:
 	case FATAL_DEFAULT:
-		*status = EX_TEMPFAIL;
 		break;
-	}
+	default:
+		return;
+	}
+	*status = EX_TEMPFAIL;
 }
 
 static void open_logfile(const char *username)


More information about the dovecot-cvs mailing list