Mercurial > dovecot > core-2.2
changeset 15473:646c5d0a60b5
mbox: If mailbox_update() doesn't affect the mbox file, don't sync it.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 15 Dec 2012 13:25:49 +0200 |
parents | 0e88b2518e0f |
children | b765a09d8c6c |
files | src/lib-storage/index/mbox/mbox-storage.c |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-storage.c Sat Dec 15 13:25:34 2012 +0200 +++ b/src/lib-storage/index/mbox/mbox-storage.c Sat Dec 15 13:25:49 2012 +0200 @@ -491,17 +491,21 @@ mbox_mailbox_update(struct mailbox *box, const struct mailbox_update *update) { struct mbox_mailbox *mbox = (struct mbox_mailbox *)box; - int ret; + int ret = 0; if (!box->opened) { if (mailbox_open(box) < 0) return -1; } - mbox->sync_hdr_update = update; - ret = mbox_sync(mbox, MBOX_SYNC_HEADER | MBOX_SYNC_FORCE_SYNC | - MBOX_SYNC_REWRITE); - mbox->sync_hdr_update = NULL; + if (update->uid_validity != 0 || update->min_next_uid != 0) { + mbox->sync_hdr_update = update; + ret = mbox_sync(mbox, MBOX_SYNC_HEADER | MBOX_SYNC_FORCE_SYNC | + MBOX_SYNC_REWRITE); + mbox->sync_hdr_update = NULL; + } + if (ret == 0) + ret = index_storage_mailbox_update(box, update); return ret; }