Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6327:b8b02d155599 HEAD
If transaction log is deleted under us, recreate it immediately.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 27 Aug 2007 19:12:59 +0300 |
parents | 3d7b93aef6b3 |
children | 29d249982282 |
files | src/lib-index/mail-transaction-log.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ "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)) {