dovecot-1.1: Maildir error handling fixes if appending to uidlis...

dovecot at dovecot.org dovecot at dovecot.org
Sat May 17 01:20:23 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/4a0e2927a232
changeset: 7528:4a0e2927a232
user:      Timo Sirainen <tss at iki.fi>
date:      Sat May 17 01:20:19 2008 +0300
description:
Maildir error handling fixes if appending to uidlist failed.

diffstat:

1 file changed, 2 insertions(+), 4 deletions(-)
src/lib-storage/index/maildir/maildir-uidlist.c |    6 ++----

diffs (43 lines):

diff -r 20c6e9545d56 -r 4a0e2927a232 src/lib-storage/index/maildir/maildir-uidlist.c
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Sat May 17 01:12:34 2008 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Sat May 17 01:20:19 2008 +0300
@@ -1016,7 +1016,6 @@ static int maildir_uidlist_write_fd(stru
 	if (ret < 0) {
 		mail_storage_set_critical(storage,
 			"o_stream_send(%s) failed: %m", path);
-		(void)close(fd);
 		return -1;
 	}
 
@@ -1024,7 +1023,6 @@ static int maildir_uidlist_write_fd(stru
 		if (fdatasync(fd) < 0) {
 			mail_storage_set_critical(storage,
 				"fdatasync(%s) failed: %m", path);
-			(void)close(fd);
 			return -1;
 		}
 	}
@@ -1091,14 +1089,12 @@ static int maildir_uidlist_recreate(stru
 	} else if (fstat(fd, &st) < 0) {
 		mail_storage_set_critical(box->storage,
 			"fstat(%s) failed: %m", temp_path);
-		(void)close(fd);
 		ret = -1;
 	} else if (file_size != (uoff_t)st.st_size) {
 		i_assert(!file_dotlock_is_locked(uidlist->dotlock));
 		mail_storage_set_critical(box->storage,
 			"Maildir uidlist dotlock overridden: %s",
 			uidlist->path);
-		(void)close(fd);
 		ret = -1;
 	} else {
 		maildir_uidlist_close(uidlist);
@@ -1110,6 +1106,8 @@ static int maildir_uidlist_recreate(stru
 		uidlist->recreate = FALSE;
 		maildir_uidlist_update_hdr(uidlist, &st);
 	}
+	if (ret < 0)
+		(void)close(fd);
 	return ret;
 }
 


More information about the dovecot-cvs mailing list