[dovecot-cvs] dovecot/src/deliver deliver.c,1.46,1.47

tss at dovecot.org tss at dovecot.org
Thu Feb 15 14:26:26 UTC 2007


Update of /var/lib/cvs/dovecot/src/deliver
In directory talvi:/tmp/cvs-serv28765/deliver

Modified Files:
	deliver.c 
Log Message:
Hook all exit()s and if the exit code is one of Dovecot's own FATAL_* ones,
replace them with EX_TEMPFAIL.



Index: deliver.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/deliver.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- deliver.c	22 Jan 2007 10:57:13 -0000	1.46
+++ deliver.c	15 Feb 2007 14:26:24 -0000	1.47
@@ -375,6 +375,21 @@
 	return input;
 }
 
+static void failure_exit_callback(int *status)
+{
+	/* we want all our exit codes to be sysexits.h compatible */
+	switch (*status) {
+	case FATAL_LOGOPEN:
+	case FATAL_LOGWRITE:
+	case FATAL_LOGERROR:
+	case FATAL_OUTOFMEM:
+	case FATAL_EXEC:
+	case FATAL_DEFAULT:
+		*status = EX_TEMPFAIL;
+		break;
+	}
+}
+
 static void open_logfile(const char *username)
 {
 	const char *prefix, *log_path, *stamp;
@@ -397,6 +412,8 @@
 	if (log_path != NULL && *log_path != '\0')
 		i_set_info_file(log_path);
 
+	i_set_failure_exit_callback(failure_exit_callback);
+
 	stamp = getenv("LOG_TIMESTAMP");
 	if (stamp == NULL)
 		stamp = DEFAULT_FAILURE_STAMP_FORMAT;



More information about the dovecot-cvs mailing list