[dovecot-cvs] dovecot/src/lib failures.c,1.27,1.27.2.1

cras at dovecot.org cras at dovecot.org
Sun Jul 2 16:47:02 EEST 2006


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

Modified Files:
      Tag: branch_1_0
	failures.c 
Log Message:
If writing to log file fails, restore errno before %m is used. Although the
log writing most likely fails anyway at that point, but at least strace logs
show it right. :)



Index: failures.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/failures.c,v
retrieving revision 1.27
retrieving revision 1.27.2.1
diff -u -d -r1.27 -r1.27.2.1
--- failures.c	16 Oct 2005 10:37:18 -0000	1.27
+++ failures.c	2 Jul 2006 13:47:00 -0000	1.27.2.1
@@ -93,8 +93,12 @@
 		fputs(format, f);
 	} else {
 		write_prefix(f);
-
 		fputs(prefix, f);
+
+		/* write may have failed, restore errno so %m works. although
+		   it probably can't write the error then anyway. */
+		errno = old_errno;
+
 		/* make sure there's no %n in there and fix %m */
                 (void)printf_string_upper_bound(&format, args);
 		vfprintf(f, format, args2);



More information about the dovecot-cvs mailing list