diff src/lib-storage/index/maildir/maildir-sync.c @ 3530:e9695ec7925b HEAD

Recursive maildir uidlist syncs caused assert crashes. Also did some cleanups.
author Timo Sirainen <tss@iki.fi>
date Sun, 14 Aug 2005 22:02:54 +0300
parents e2fe8222449d
children 505a5f3f3857
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-sync.c	Sun Aug 14 21:25:22 2005 +0300
+++ b/src/lib-storage/index/maildir/maildir-sync.c	Sun Aug 14 22:02:54 2005 +0300
@@ -1222,17 +1222,16 @@
 			return -1;
 	}
 
-	if ((ret = maildir_uidlist_lock(ctx->mbox->uidlist)) <= 0) {
+	ctx->partial = !cur_changed;
+	ret = maildir_uidlist_sync_init(ctx->mbox->uidlist, ctx->partial,
+					&ctx->uidlist_sync_ctx);
+	if (ret <= 0) {
 		/* failure / timeout. if forced is TRUE, we could still go
 		   forward and check only for renamed files, but is it worth
 		   the trouble? .. */
 		return ret;
 	}
 
-	ctx->partial = !cur_changed;
-	ctx->uidlist_sync_ctx =
-		maildir_uidlist_sync_init(ctx->mbox->uidlist, ctx->partial);
-
 	if (new_changed || cur_changed) {
 		/* if we're going to check cur/ dir our current logic requires
 		   that new/ dir is checked as well. it's a good idea anyway. */
@@ -1254,6 +1253,10 @@
 	}
 
 	if (!ctx->mbox->syncing_commit) {
+		/* NOTE: index syncing here might cause a re-sync due to
+		   files getting lost, so this function might be called
+		   re-entrantly. FIXME: and that breaks in
+		   maildir_uidlist_sync_deinit() */
 		ret = maildir_sync_index_finish(ctx->index_sync_ctx,
 						ctx->partial);
 		if (ret < 0) {