[dovecot-cvs] dovecot/src/lib-index mail-index.c, 1.269, 1.270 mailbox-list-index-sync.c, 1.6, 1.7 mailbox-list-index.c, 1.6, 1.7

tss at dovecot.org tss at dovecot.org
Thu Mar 15 14:04:48 EET 2007


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

Modified Files:
	mail-index.c mailbox-list-index-sync.c mailbox-list-index.c 
Log Message:
Error handling fixes



Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.269
retrieving revision 1.270
diff -u -d -r1.269 -r1.270
--- mail-index.c	14 Mar 2007 19:39:25 -0000	1.269
+++ mail-index.c	15 Mar 2007 12:04:45 -0000	1.270
@@ -1727,8 +1727,9 @@
 	i_assert(index->excl_lock_count == 0);
 
 	old_map = index->map;
+	if (old_map != NULL)
+		old_map->refcount++;
 	old_fd = index->fd;
-	old_map->refcount++;
 
 	/* new file, new locks. the old fd can keep its locks, they don't
 	   matter anymore as no-one's going to modify the file. */
@@ -1768,7 +1769,8 @@
 		mail_index_unlock(index, lock_id);
 
 	if (ret == 0) {
-		mail_index_unmap(index, &old_map);
+		if (old_map != NULL)
+			mail_index_unmap(index, &old_map);
 		if (old_file_lock != NULL)
 			file_lock_free(&old_file_lock);
 		if (close(old_fd) < 0)

Index: mailbox-list-index-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mailbox-list-index-sync.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mailbox-list-index-sync.c	15 Mar 2007 01:25:19 -0000	1.6
+++ mailbox-list-index-sync.c	15 Mar 2007 12:04:45 -0000	1.7
@@ -831,7 +831,7 @@
 			ret = mailbox_list_index_compress(ctx);
 	}
 
-	if (ctx->mail_sync_ctx != NULL) {
+	if (ctx->trans != NULL) {
 		if (ret < 0)
 			mail_index_transaction_rollback(&ctx->trans);
 		else {
@@ -842,7 +842,8 @@
 							  &seq, &offset) < 0)
 				ret = -1;
 		}
-
+	}
+	if (ctx->mail_sync_ctx != NULL) {
 		if (ret < 0)
 			mail_index_sync_rollback(&ctx->mail_sync_ctx);
 		else {

Index: mailbox-list-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mailbox-list-index.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mailbox-list-index.c	15 Mar 2007 01:52:49 -0000	1.6
+++ mailbox-list-index.c	15 Mar 2007 12:04:45 -0000	1.7
@@ -126,7 +126,9 @@
 	if (hdr->uid_validity != index->mail_index->hdr->uid_validity &&
 	    index->mail_index->hdr->uid_validity != 0) {
 		mail_index_set_error(index->mail_index,
-			"uid_validity changed in file %s", index->filepath);
+			"uid_validity changed in file %s: %u -> %u",
+			index->filepath, index->mail_index->hdr->uid_validity,
+			hdr->uid_validity);
 		mail_index_mark_corrupted(index->mail_index);
 		return -1;
 	}



More information about the dovecot-cvs mailing list