Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5708:7420a96ebc8f HEAD
If new/ directory is lost when syncing, assume the mailbox was deleted and
make the mailbox inconsistent (which disconnects the client).
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 12 Jun 2007 20:06:51 +0300 |
parents | f63c99fe863c |
children | c6cde7452a9f |
files | src/lib-storage/index/index-storage.c src/lib-storage/index/index-storage.h src/lib-storage/index/maildir/maildir-sync.c |
diffstat | 3 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-storage.c Tue Jun 12 19:55:36 2007 +0300 +++ b/src/lib-storage/index/index-storage.c Tue Jun 12 20:06:51 2007 +0300 @@ -458,7 +458,8 @@ { struct index_mailbox *ibox = (struct index_mailbox *) box; - return mail_index_view_is_inconsistent(ibox->view); + return mail_index_view_is_inconsistent(ibox->view) || + ibox->mailbox_deleted; } void mail_storage_set_index_error(struct index_mailbox *ibox)
--- a/src/lib-storage/index/index-storage.h Tue Jun 12 19:55:36 2007 +0300 +++ b/src/lib-storage/index/index-storage.h Tue Jun 12 20:06:51 2007 +0300 @@ -67,6 +67,7 @@ unsigned int notify_pending:1; unsigned int move_to_memory:1; unsigned int fsync_disable:1; + unsigned int mailbox_deleted:1; }; struct index_transaction_context {
--- a/src/lib-storage/index/maildir/maildir-sync.c Tue Jun 12 19:55:36 2007 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync.c Tue Jun 12 20:06:51 2007 +0300 @@ -931,6 +931,12 @@ *new_changed_r = *cur_changed_r = FALSE; if (stat(new_dir, &st) < 0) { + if (errno == ENOENT) { + /* mailbox was deleted under us. this isn't the only + way it can break, but the most common one. */ + ibox->mailbox_deleted = TRUE; + return -1; + } mail_storage_set_critical(&mbox->storage->storage, "stat(%s) failed: %m", new_dir); return -1;