dovecot-2.1: lib-index: When marking index corrupted, delete als...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Sep 4 11:52:25 EEST 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/7b240ecc37b5
changeset: 13379:7b240ecc37b5
user: Timo Sirainen <tss at iki.fi>
date: Sun Sep 04 11:52:16 2011 +0300
description:
lib-index: When marking index corrupted, delete also transaction log file.
diffstat:
src/lib-index/mail-index.c | 1 +
src/lib-index/mail-transaction-log.c | 11 +++++++++++
src/lib-index/mail-transaction-log.h | 2 ++
3 files changed, 14 insertions(+), 0 deletions(-)
diffs (43 lines):
diff -r f8d5f872498d -r 7b240ecc37b5 src/lib-index/mail-index.c
--- a/src/lib-index/mail-index.c Sun Sep 04 11:51:23 2011 +0300
+++ b/src/lib-index/mail-index.c Sun Sep 04 11:52:16 2011 +0300
@@ -771,6 +771,7 @@
if (unlink(index->filepath) < 0 &&
errno != ENOENT && errno != ESTALE)
mail_index_set_syscall_error(index, "unlink()");
+ (void)mail_transaction_log_unlink(index->log);
}
}
diff -r f8d5f872498d -r 7b240ecc37b5 src/lib-index/mail-transaction-log.c
--- a/src/lib-index/mail-transaction-log.c Sun Sep 04 11:51:23 2011 +0300
+++ b/src/lib-index/mail-transaction-log.c Sun Sep 04 11:52:16 2011 +0300
@@ -539,6 +539,17 @@
return 0;
}
+int mail_transaction_log_unlink(struct mail_transaction_log *log)
+{
+ if (unlink(log->filepath) < 0 &&
+ errno != ENOENT && errno != ESTALE) {
+ mail_index_file_set_syscall_error(log->index, log->filepath,
+ "unlink()");
+ return -1;
+ }
+ return 0;
+}
+
void mail_transaction_log_get_dotlock_set(struct mail_transaction_log *log,
struct dotlock_settings *set_r)
{
diff -r f8d5f872498d -r 7b240ecc37b5 src/lib-index/mail-transaction-log.h
--- a/src/lib-index/mail-transaction-log.h Sun Sep 04 11:51:23 2011 +0300
+++ b/src/lib-index/mail-transaction-log.h Sun Sep 04 11:52:16 2011 +0300
@@ -282,5 +282,7 @@
If it doesn't exist, mtime_r is set to 0. */
int mail_transaction_log_get_mtime(struct mail_transaction_log *log,
time_t *mtime_r);
+/* Unlink transaction log files */
+int mail_transaction_log_unlink(struct mail_transaction_log *log);
#endif
More information about the dovecot-cvs
mailing list