[dovecot-cvs] dovecot/src/deliver deliver.c,1.20.2.25,1.20.2.26

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


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

Modified Files:
      Tag: branch_1_0
	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.20.2.25
retrieving revision 1.20.2.26
diff -u -d -r1.20.2.25 -r1.20.2.26
--- deliver.c	22 Jan 2007 10:57:11 -0000	1.20.2.25
+++ deliver.c	15 Feb 2007 14:26:21 -0000	1.20.2.26
@@ -377,6 +377,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;
@@ -399,6 +414,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