dovecot-1.1: If logging failed to info log, try to log a failure...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 29 09:43:37 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/23f2dec7c54b
changeset: 7837:23f2dec7c54b
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 29 09:43:33 2008 +0300
description:
If logging failed to info log, try to log a failure to error log if it's elsewhere.

diffstat:

1 file changed, 9 insertions(+), 2 deletions(-)
src/lib/failures.c |   11 +++++++++--

diffs (28 lines):

diff -r 0716945b2680 -r 23f2dec7c54b src/lib/failures.c
--- a/src/lib/failures.c	Thu Aug 28 13:54:15 2008 +0300
+++ b/src/lib/failures.c	Fri Aug 29 09:43:33 2008 +0300
@@ -90,6 +90,7 @@ static int log_fd_write(int fd, const un
 		}
 		if (ret == 0) {
 			/* out of disk space? */
+			errno = ENOSPC;
 			return -1;
 		}
 		if (errno != EAGAIN)
@@ -166,8 +167,14 @@ void default_error_handler(enum log_type
 	int fd = type == LOG_TYPE_INFO ? log_info_fd : log_fd;
 
 	if (default_handler(failure_log_type_prefixes[type],
-			    fd, format, args) < 0)
-		failure_exit(FATAL_LOGWRITE);
+			    fd, format, args) < 0) {
+		if (fd == log_fd)
+			failure_exit(FATAL_LOGWRITE);
+		/* we failed to log to info log, try to log the write error
+		   to error log - maybe that'll work. */
+		i_fatal_status(FATAL_LOGWRITE,
+			       "write() failed to info log: %m");
+	}
 }
 
 void i_log_type(enum log_type type, const char *format, ...)


More information about the dovecot-cvs mailing list