[dovecot-cvs] dovecot/src/lib failures.c,1.34,1.35

tss at dovecot.org tss at dovecot.org
Thu Mar 8 20:27:57 EET 2007


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

Modified Files:
	failures.c 
Log Message:
Moved errno preserving to i_error/i_warning/i_info from the failure handler,
so each failure handler doesn't have to do that itself.



Index: failures.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/failures.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- failures.c	15 Feb 2007 14:25:27 -0000	1.34
+++ failures.c	8 Mar 2007 18:27:55 -0000	1.35
@@ -155,41 +155,29 @@
 static void __attr_format__(1, 0)
 default_error_handler(const char *format, va_list args)
 {
-	int old_errno = errno;
-
 	if (default_handler("Error: ", log_fd, format, args) < 0)
 		failure_exit(FATAL_LOGERROR);
 
 	if (fflush(log_fd) < 0)
 		failure_exit(FATAL_LOGWRITE);
-
-	errno = old_errno;
 }
 
 static void __attr_format__(1, 0)
 default_warning_handler(const char *format, va_list args)
 {
-	int old_errno = errno;
-
 	(void)default_handler("Warning: ", log_fd, format, args);
 
 	if (fflush(log_fd) < 0)
 		failure_exit(FATAL_LOGWRITE);
-
-	errno = old_errno;
 }
 
 static void __attr_format__(1, 0)
 default_info_handler(const char *format, va_list args)
 {
-	int old_errno = errno;
-
 	(void)default_handler("Info: ", log_info_fd, format, args);
 
 	if (fflush(log_info_fd) < 0)
 		failure_exit(FATAL_LOGWRITE);
-
-	errno = old_errno;
 }
 
 void i_panic(const char *format, ...)
@@ -221,29 +209,38 @@
 
 void i_error(const char *format, ...)
 {
+	int old_errno = errno;
 	va_list args;
 
 	va_start(args, format);
 	error_handler(format, args);
 	va_end(args);
+
+	errno = old_errno;
 }
 
 void i_warning(const char *format, ...)
 {
+	int old_errno = errno;
 	va_list args;
 
 	va_start(args, format);
 	warning_handler(format, args);
 	va_end(args);
+
+	errno = old_errno;
 }
 
 void i_info(const char *format, ...)
 {
+	int old_errno = errno;
 	va_list args;
 
 	va_start(args, format);
 	info_handler(format, args);
 	va_end(args);
+
+	errno = old_errno;
 }
 
 void i_set_panic_handler(failure_callback_t *callback __attr_noreturn__)



More information about the dovecot-cvs mailing list