changeset 2709:e3206b95ec0f HEAD

fix
author Timo Sirainen <tss@iki.fi>
date Fri, 08 Oct 2004 21:19:12 +0300
parents f1e9f3ec8135
children ebc72e393388
files src/lib-storage/index/mbox/mbox-sync.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync.c	Fri Oct 08 20:51:47 2004 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Fri Oct 08 21:19:12 2004 +0300
@@ -248,7 +248,7 @@
 			"mbox sync: Expunged message reappeared in mailbox %s "
 			"(UID %u < %u)", sync_ctx->ibox->path, uid,
 			sync_ctx->hdr->next_uid);
-		ret = 0;
+		ret = 0; rec = NULL;
 	} else if (rec != NULL && rec->uid != uid) {
 		/* new UID in the middle of the mailbox - shouldn't happen */
 		mail_storage_set_critical(sync_ctx->ibox->box.storage,
@@ -802,18 +802,19 @@
 		if (mail_ctx->pseudo)
 			uid = 0;
 
-		rec = NULL;
+		rec = NULL; ret = 1;
 		if (uid != 0) {
 			ret = mbox_sync_read_index_rec(sync_ctx, uid, &rec);
 			if (ret < 0)
 				return -1;
-			if (ret == 0)
-				uid = 0;
 		}
 
-		if (uid == 0 && !mail_ctx->pseudo &&
-		    (sync_ctx->delay_writes ||
-		     sync_ctx->idx_seq <= messages_count)) {
+		if (ret == 0) {
+			/* UID found but it's broken */
+			uid = 0;
+		} else if (uid == 0 && !mail_ctx->pseudo &&
+			   (sync_ctx->delay_writes ||
+			    sync_ctx->idx_seq <= messages_count)) {
 			/* If we can't use/store X-UID header, use MD5 sum.
 			   Also check for existing MD5 sums when we're actually
 			   able to write X-UIDs. */