[dovecot-cvs] dovecot/src/lib failures.c,1.27.2.6,1.27.2.7

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


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

Modified Files:
      Tag: branch_1_0
	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.27.2.6
retrieving revision 1.27.2.7
diff -u -d -r1.27.2.6 -r1.27.2.7
--- failures.c	15 Feb 2007 14:25:24 -0000	1.27.2.6
+++ failures.c	8 Mar 2007 18:27:50 -0000	1.27.2.7
@@ -152,39 +152,27 @@
 
 static void 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 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 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, ...)
@@ -216,29 +204,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