]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Rewrite X-IMAPbase: header before updating index file header, so that we
authorTimo Sirainen <tss@iki.fi>
Sat, 31 May 2008 11:27:27 +0000 (14:27 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 31 May 2008 11:27:27 +0000 (14:27 +0300)
write the latest mtime as sync_stamp.

--HG--
branch : HEAD

src/lib-storage/index/mbox/mbox-sync.c

index fc632b05739cb49fcb5247c97bb62ec4c97d70b5..3cdcc3aef22e23c10e8e3d279af2c6b503d32d80 100644 (file)
@@ -1534,6 +1534,14 @@ static int mbox_sync_do(struct mbox_sync_context *sync_ctx,
           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 @@ again:
        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 */