[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-sync.c, 1.87, 1.88

tss at dovecot.org tss at dovecot.org
Thu Jan 25 16:01:41 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv17200

Modified Files:
	maildir-sync.c 
Log Message:
Error handling fixes



Index: maildir-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- maildir-sync.c	15 Dec 2006 18:38:22 -0000	1.87
+++ maildir-sync.c	25 Jan 2007 16:01:37 -0000	1.88
@@ -494,8 +494,10 @@
 			}
 		}
 
-		if (mail_index_lookup_uid(ctx->view, seq, &uid) < 0)
+		if (mail_index_lookup_uid(ctx->view, seq, &uid) < 0) {
+			mail_storage_set_index_error(&ctx->mbox->ibox);
 			return -1;
+		}
 
 		ctx->seq = seq;
 		if (expunged) {
@@ -548,8 +550,10 @@
 	if (mail_index_lookup_uid_range(view, sync_rec->uid1,
 					sync_rec->uid2,
 					&sync_copy.uid1,
-					&sync_copy.uid2) < 0)
+					&sync_copy.uid2) < 0) {
+		mail_storage_set_index_error(&ctx->mbox->ibox);
 		return -1;
+	}
 
 	if (sync_copy.uid1 == 0) {
 		/* UIDs were expunged */
@@ -578,8 +582,11 @@
 	int ret;
 
 	ret = mail_index_sync_next(ctx->sync_ctx, &sync_rec);
-	if (ret <= 0)
+	if (ret <= 0) {
+		if (ret < 0)
+			mail_storage_set_index_error(&ctx->mbox->ibox);
 		return ret;
+	}
 
 	t_array_init(&ctx->sync_recs, 32);
 	do {
@@ -589,6 +596,9 @@
 		ret = mail_index_sync_next(ctx->sync_ctx, &sync_rec);
 	} while (ret > 0);
 
+	if (ret < 0)
+		mail_storage_set_index_error(&ctx->mbox->ibox);
+
 	if (maildir_sync_record(ctx, NULL) < 0)
 		return -1;
 	return ret;
@@ -914,9 +924,10 @@
 			mail_index_transaction_rollback(&sync_ctx->trans);
 		else {
 			if (mail_index_transaction_commit(&sync_ctx->trans,
-							  &seq, &offset) < 0)
+							  &seq, &offset) < 0) {
+				mail_storage_set_index_error(&mbox->ibox);
 				ret = -1;
-			else if (seq != 0) {
+			} else if (seq != 0) {
 				mbox->ibox.commit_log_file_seq = seq;
 				mbox->ibox.commit_log_file_offset = offset;
 			}
@@ -930,18 +941,16 @@
 		   to open the file which was just unlinked) we don't try to
 		   start a second index sync and crash. */
 		mbox->syncing_commit = TRUE;
-		if (mail_index_sync_commit(&sync_ctx->sync_ctx) < 0)
+		if (mail_index_sync_commit(&sync_ctx->sync_ctx) < 0) {
+			mail_storage_set_index_error(&mbox->ibox);
 			ret = -1;
-		else {
+		} else {
 			mbox->ibox.commit_log_file_seq = 0;
 			mbox->ibox.commit_log_file_offset = 0;
 		}
 		mbox->syncing_commit = FALSE;
 	}
 
-	if (ret < 0)
-		mail_storage_set_index_error(&mbox->ibox);
-
 	maildir_keywords_sync_deinit(sync_ctx->keywords_sync_ctx);
         sync_ctx->keywords_sync_ctx = NULL;
 
@@ -1066,6 +1075,7 @@
 		}
 
 		if (mail_index_lookup(view, seq, &rec) < 0) {
+			mail_storage_set_index_error(&mbox->ibox);
 			ret = -1;
 			break;
 		}
@@ -1155,6 +1165,7 @@
 
 		/* update keywords if they have changed */
 		if (mail_index_lookup_keywords(view, seq, &idx_keywords) < 0) {
+			mail_storage_set_index_error(&mbox->ibox);
 			ret = -1;
 			break;
 		}



More information about the dovecot-cvs mailing list