From: Timo Sirainen Date: Fri, 29 Aug 2008 06:43:18 +0000 (+0300) Subject: If logging failed to info log, try to log a failure to error log if it's elsewhere. X-Git-Tag: 1.2.alpha1~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fdf83bdccb4b06a696f905100327539327b15b67;p=thirdparty%2Fdovecot%2Fcore.git If logging failed to info log, try to log a failure to error log if it's elsewhere. --HG-- branch : HEAD --- diff --git a/src/lib/failures.c b/src/lib/failures.c index 17e0f42a80..bcc1da786d 100644 --- a/src/lib/failures.c +++ b/src/lib/failures.c @@ -90,6 +90,7 @@ static int log_fd_write(int fd, const unsigned char *data, unsigned int len) } 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 type, const char *format, va_list args) 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, ...)