dovecot-2.0: lib-index: When index is reset, make sure old dovec...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Mar 8 19:53:45 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/6a2f7843327c
changeset: 10866:6a2f7843327c
user: Timo Sirainen <tss at iki.fi>
date: Mon Mar 08 19:53:28 2010 +0200
description:
lib-index: When index is reset, make sure old dovecot.index gets deleted.
diffstat:
src/lib-index/mail-index-transaction.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diffs (17 lines):
diff -r 42e5d937555e -r 6a2f7843327c src/lib-index/mail-index-transaction.c
--- a/src/lib-index/mail-index-transaction.c Mon Mar 08 19:39:43 2010 +0200
+++ b/src/lib-index/mail-index-transaction.c Mon Mar 08 19:53:28 2010 +0200
@@ -146,6 +146,13 @@
mail_transaction_log_get_head(log, &log_seq2, &log_offset2);
i_assert(log_seq1 == log_seq2);
+ if (t->reset) {
+ /* get rid of the old index. it might just confuse readers,
+ especially if it's broken. */
+ if (unlink(log->index->filepath) < 0 && errno != ENOENT)
+ i_error("unlink(%s) failed: %m", log->index->filepath);
+ }
+
*commit_size_r = log_offset2 - log_offset1;
if ((t->flags & MAIL_INDEX_TRANSACTION_FLAG_HIDE) != 0 &&
More information about the dovecot-cvs
mailing list