dovecot-2.0: Removed LOG_TYPE_ERROR_IGNORE_IF_SEEN_FATAL. It's n...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 5 03:30:08 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/b57e1c3ea3f7
changeset: 9215:b57e1c3ea3f7
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 04 20:30:03 2009 -0400
description:
Removed LOG_TYPE_ERROR_IGNORE_IF_SEEN_FATAL. It's no longer necessary.

diffstat:

3 files changed, 12 insertions(+), 35 deletions(-)
src/lib/failures.c           |   20 +-------------------
src/lib/failures.h           |    5 -----
src/master/service-process.c |   22 +++++++++++-----------

diffs (115 lines):

diff -r 7def7fa61d68 -r b57e1c3ea3f7 src/lib/failures.c
--- a/src/lib/failures.c	Mon May 04 20:24:57 2009 -0400
+++ b/src/lib/failures.c	Mon May 04 20:30:03 2009 -0400
@@ -21,8 +21,7 @@ const char *failure_log_type_prefixes[LO
 	"Warning: ",
 	"Error: ",
 	"Fatal: ",
-	"Panic: ",
-	"Error: "
+	"Panic: "
 };
 
 /* Initialize working defaults */
@@ -195,22 +194,6 @@ void i_log_type(enum log_type type, cons
 
 	va_start(args, format);
 
-	if (type == LOG_TYPE_ERROR_IGNORE_IF_SEEN_FATAL &&
-	    error_handler != i_internal_error_handler) {
-		/* this is handled specially only by internal logging.
-		   skip over the pid. */
-		T_BEGIN {
-			const char *str;
-
-			str = t_strdup_vprintf(format, args);
-			while (*str >= '0' && *str <= '9') str++;
-			if (*str == ' ') str++;
-
-			i_error("%s", str);
-		} T_END;
-		return;
-	}
-
 	if (type == LOG_TYPE_INFO)
 		info_handler(type, format, args);
 	else
@@ -346,7 +329,6 @@ void i_syslog_error_handler(enum log_typ
 		level = LOG_WARNING;
 		break;
 	case LOG_TYPE_ERROR:
-	case LOG_TYPE_ERROR_IGNORE_IF_SEEN_FATAL:
 		level = LOG_ERR;
 		break;
 	case LOG_TYPE_FATAL:
diff -r 7def7fa61d68 -r b57e1c3ea3f7 src/lib/failures.h
--- a/src/lib/failures.h	Mon May 04 20:24:57 2009 -0400
+++ b/src/lib/failures.h	Mon May 04 20:30:03 2009 -0400
@@ -20,11 +20,6 @@ enum log_type {
 	LOG_TYPE_ERROR,
 	LOG_TYPE_FATAL,
 	LOG_TYPE_PANIC,
-
-	/* Special message from master to log process: Log message begins with
-	   "<pid> " and if <pid> has already logged a fatal/panic, this message
-	   shouldn't be written to the log. Otherwise log as an error. */
-	LOG_TYPE_ERROR_IGNORE_IF_SEEN_FATAL,
 
 	LOG_TYPE_COUNT,
 	LOG_TYPE_OPTION
diff -r 7def7fa61d68 -r b57e1c3ea3f7 src/master/service-process.c
--- a/src/master/service-process.c	Mon May 04 20:24:57 2009 -0400
+++ b/src/master/service-process.c	Mon May 04 20:30:03 2009 -0400
@@ -557,12 +557,12 @@ static void log_coredump(struct service 
 
 static void
 service_process_get_status_error(string_t *str, struct service_process *process,
-				 int status, enum log_type *type_r)
+				 int status, bool *default_fatal_r)
 {
 	struct service *service = process->service;
 	const char *msg;
 
-	*type_r = LOG_TYPE_ERROR;
+	*default_fatal_r = FALSE;
 
 	str_printfa(str, "service(%s): child %s ", service->set->name,
 		    dec2str(process->pid));
@@ -588,17 +588,16 @@ service_process_get_status_error(string_
 		str_printfa(str, " (%s)", msg);
 
 	if (status == FATAL_DEFAULT)
-		*type_r = LOG_TYPE_ERROR_IGNORE_IF_SEEN_FATAL;
+		*default_fatal_r = TRUE;
 }
 
 static void service_process_log(struct service_process *process,
-				enum log_type type, const char *str)
+				bool default_fatal, const char *str)
 {
 	const char *data;
 
-	if (type != LOG_TYPE_ERROR_IGNORE_IF_SEEN_FATAL ||
-	    process->service->log_fd[1] == -1) {
-		i_log_type(type, "%s", str);
+	if (!default_fatal || process->service->log_fd[1] == -1) {
+		i_error("%s", str);
 		return;
 	}
 
@@ -623,10 +622,11 @@ void service_process_log_status_error(st
 	}
 	T_BEGIN {
 		string_t *str = t_str_new(256);
-		enum log_type type;
-
-		service_process_get_status_error(str, process, status, &type);
+		bool default_fatal;
+
+		service_process_get_status_error(str, process, status,
+						 &default_fatal);
 		if (str_len(str) > 0)
-			service_process_log(process, type, str_c(str));
+			service_process_log(process, default_fatal, str_c(str));
 	} T_END;
 }


More information about the dovecot-cvs mailing list