dovecot-1.0: If we expunged the first message but there were no ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 9 20:00:50 EEST 2007
details: http://hg.dovecot.org/dovecot-1.0/rev/25efd6b1fe44
changeset: 5374:25efd6b1fe44
user: Timo Sirainen <tss at iki.fi>
date: Thu Aug 09 20:00:43 2007 +0300
description:
If we expunged the first message but there were no other changes, we might
have not actually expunged it.
diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
src/lib-storage/index/mbox/mbox-sync.c | 15 ++++++++++++---
diffs (32 lines):
diff -r 870e4d1cf2b3 -r 25efd6b1fe44 src/lib-storage/index/mbox/mbox-sync.c
--- a/src/lib-storage/index/mbox/mbox-sync.c Thu Aug 09 15:05:15 2007 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync.c Thu Aug 09 20:00:43 2007 +0300
@@ -1761,8 +1761,17 @@ __again:
before index syncing is started to avoid deadlocks, so we
don't have much choice either (well, easy ones anyway). */
int lock_type = mbox->mbox_readonly ? F_RDLCK : F_WRLCK;
- if (mbox_lock(mbox, lock_type, &lock_id) <= 0)
- return -1;
+ int ret;
+
+ if ((ret = mbox_lock(mbox, lock_type, &lock_id)) <= 0) {
+ if (ret == 0 || lock_type == F_RDLCK)
+ return -1;
+
+ /* try as read-only */
+ if (mbox_lock(mbox, F_RDLCK, &lock_id) <= 0)
+ return -1;
+ mbox->mbox_readonly = TRUE;
+ }
}
if ((flags & MBOX_SYNC_LAST_COMMIT) != 0) {
@@ -1833,7 +1842,7 @@ __again:
if (mbox_sync_read_index_syncs(&sync_ctx, 1, &expunged) < 0)
return -1;
- if (sync_ctx.sync_rec.uid1 == 0) {
+ if (sync_ctx.sync_rec.uid1 == 0 && !expunged) {
if (mail_index_transaction_commit(&sync_ctx.t,
&seq, &offset) < 0) {
mail_storage_set_index_error(&mbox->ibox);
More information about the dovecot-cvs
mailing list