dovecot-2.0: mbox: mailbox_get_guid() works now without trying t...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 15 12:34:13 EEST 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/0264ac68c770
changeset: 12912:0264ac68c770
user: Timo Sirainen <tss at iki.fi>
date: Thu Sep 15 12:34:03 2011 +0300
description:
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.
diffstat:
src/lib-storage/index/mbox/mbox-storage.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r 1910c76a6cc9 -r 0264ac68c770 src/lib-storage/index/mbox/mbox-storage.c
--- 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;
More information about the dovecot-cvs
mailing list