changeset 7584:e528d9e3cdc8 HEAD

Rewrite X-IMAPbase: header before updating index file header, so that we write the latest mtime as sync_stamp.
author Timo Sirainen <tss@iki.fi>
date Sat, 31 May 2008 14:27:27 +0300
parents a99b9735f875
children 326ca0ed8983
files src/lib-storage/index/mbox/mbox-sync.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync.c	Sat May 31 13:59:46 2008 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Sat May 31 14:27:27 2008 +0300
@@ -1534,6 +1534,14 @@
 	   ignore them, as we've overwritten them above. */
 	index_sync_changes_reset(sync_ctx->sync_changes);
 
+	if (sync_ctx->base_uid_last != sync_ctx->next_uid-1 &&
+	    ret == 0 && !sync_ctx->delay_writes &&
+	    sync_ctx->base_uid_last_offset != 0) {
+		/* Rewrite uid_last in X-IMAPbase header if we've seen it
+		   (ie. the file isn't empty) */
+                ret = mbox_rewrite_base_uid_last(sync_ctx);
+	}
+
 	if (mbox_sync_update_index_header(sync_ctx) < 0)
 		return -1;
 
@@ -1791,14 +1799,6 @@
 	sync_ctx.t = NULL;
 	sync_ctx.index_sync_ctx = NULL;
 
-	if (sync_ctx.base_uid_last != sync_ctx.next_uid-1 &&
-	    ret == 0 && !sync_ctx.delay_writes &&
-	    sync_ctx.base_uid_last_offset != 0) {
-		/* Rewrite uid_last in X-IMAPbase header if we've seen it
-		   (ie. the file isn't empty) */
-                ret = mbox_rewrite_base_uid_last(&sync_ctx);
-	}
-
 	if (ret == 0 && mbox->mbox_fd != -1 && mbox->ibox.keep_recent &&
 	    !sync_ctx.mbox->mbox_readonly) {
 		/* try to set atime back to its original value */