[dovecot-cvs] dovecot/src/lib-index mail-index-lock.c, 1.54.2.5, 1.54.2.6

tss at dovecot.org tss at dovecot.org
Sun Mar 11 20:03:54 EET 2007


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

Modified Files:
      Tag: branch_1_0
	mail-index-lock.c 
Log Message:
Delete copy-lock file instead of rename()ing it if we've moved to in-memory
indexes.



Index: mail-index-lock.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-lock.c,v
retrieving revision 1.54.2.5
retrieving revision 1.54.2.6
diff -u -d -r1.54.2.5 -r1.54.2.6
--- mail-index-lock.c	11 Mar 2007 16:10:38 -0000	1.54.2.5
+++ mail-index-lock.c	11 Mar 2007 18:03:52 -0000	1.54.2.6
@@ -359,7 +359,13 @@
 		}
 	}
 
-	if (ret == 0) {
+	if (ret < 0 || MAIL_INDEX_IS_IN_MEMORY(index)) {
+		/* fsync() failed / we've since moved to in-memory indexes */
+		if (unlink(index->copy_lock_path) < 0) {
+			mail_index_set_error(index, "unlink(%s) failed: %m",
+					     index->copy_lock_path);
+		}
+	} else {
 		if (rename(index->copy_lock_path, index->filepath) < 0) {
 			mail_index_set_error(index, "rename(%s, %s) failed: %m",
 					     index->copy_lock_path,



More information about the dovecot-cvs mailing list