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

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 29 09:58:21 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/eeb09d4c9746
changeset: 7838:eeb09d4c9746
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 29 09:58:18 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 23f2dec7c54b -r eeb09d4c9746 src/deliver/deliver.c
--- a/src/deliver/deliver.c	Fri Aug 29 09:43:33 2008 +0300
+++ b/src/deliver/deliver.c	Fri Aug 29 09:58:18 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