Mercurial > dovecot > core-2.2
changeset 13487:0264ac68c770
mbox: mailbox_get_guid() works now without trying to sync the opened mailbox.
This fixes assert-crash when LDA was trying to get mailbox GUID during save.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 15 Sep 2011 12:34:03 +0300 |
parents | 1910c76a6cc9 |
children | 0dffdc3bfad1 |
files | src/lib-storage/index/mbox/mbox-storage.c |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-storage.c Thu Sep 15 11:54:11 2011 +0300 +++ b/src/lib-storage/index/mbox/mbox-storage.c Thu Sep 15 12:34:03 2011 +0300 @@ -584,8 +584,19 @@ return -1; } if (mail_guid_128_is_empty(mbox->mbox_hdr.mailbox_guid)) { - if (mailbox_sync(&mbox->box, 0) < 0) - return -1; + /* create another mailbox and sync */ + struct mailbox *box2; + struct mbox_mailbox *mbox2; + int ret; + + i_assert(mbox->mbox_lock_type == F_UNLCK); + box2 = mailbox_alloc(box->list, box->name, + MAILBOX_FLAG_KEEP_RECENT); + ret = mailbox_sync(box2, 0); + mbox2 = (struct mbox_mailbox *)box2; + memcpy(guid, mbox2->mbox_hdr.mailbox_guid, MAIL_GUID_128_SIZE); + mailbox_free(&box2); + return ret; } memcpy(guid, mbox->mbox_hdr.mailbox_guid, MAIL_GUID_128_SIZE); return 0;