dovecot: If transaction log is deleted under us, recreate it imm...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 27 19:13:52 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/b8b02d155599
changeset: 6327:b8b02d155599
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 27 19:12:59 2007 +0300
description:
If transaction log is deleted under us, recreate it immediately.

diffstat:

1 file changed, 9 insertions(+), 1 deletion(-)
src/lib-index/mail-transaction-log.c |   10 +++++++++-

diffs (20 lines):

diff -r 3d7b93aef6b3 -r b8b02d155599 src/lib-index/mail-transaction-log.c
--- a/src/lib-index/mail-transaction-log.c	Mon Aug 27 19:12:18 2007 +0300
+++ b/src/lib-index/mail-transaction-log.c	Mon Aug 27 19:12:59 2007 +0300
@@ -277,7 +277,15 @@ static int mail_transaction_log_refresh(
 							  "stat()");
 			return -1;
 		}
-		return -1;
+		/* the file should always exist at this point. if it doesn't,
+		   someone deleted it manually while the index was open. try to
+		   handle this nicely by creating a new log file. */
+		file = log->head;
+		if (mail_transaction_log_create(log) < 0)
+			return -1;
+		i_assert(file->refcount > 0);
+		file->refcount--;
+		return 0;
 	} else {
 		if (log->head->st_ino == st.st_ino &&
 		    CMP_DEV_T(log->head->st_dev, st.st_dev)) {


More information about the dovecot-cvs mailing list