Mercurial > dovecot > core-2.2
changeset 18276:e7c65fa3ffa9
lib-index: Added an assert.
It seems to be triggering later on, but not sure how it's happening.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 25 Feb 2015 18:58:50 +0200 |
parents | c398321df8f5 |
children | 6d788397444e |
files | src/lib-index/mail-transaction-log-file.c |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-file.c Wed Feb 25 15:06:29 2015 +0200 +++ b/src/lib-index/mail-transaction-log-file.c Wed Feb 25 18:58:50 2015 +0200 @@ -674,7 +674,9 @@ const char *path2; buffer_t *writebuf; int fd, ret; - bool rename_existing; + bool rename_existing, need_lock; + + need_lock = file->log->head != NULL && file->log->head->locked; if (fcntl(new_fd, F_SETFL, O_APPEND) < 0) { log_file_set_syscall_error(file, "fcntl(O_APPEND)"); @@ -774,7 +776,7 @@ file->fd = new_fd; ret = mail_transaction_log_file_stat(file, FALSE); - if (file->log->head != NULL && file->log->head->locked) { + if (need_lock) { /* we'll need to preserve the lock */ if (mail_transaction_log_file_lock(file) < 0) ret = -1; @@ -816,7 +818,9 @@ /* success */ file->fd = new_fd; - mail_transaction_log_file_add_to_list(file); + mail_transaction_log_file_add_to_list(file); + + i_assert(!need_lock || file->locked); return 1; }