dovecot-2.2: lib-index: Added an assert.
dovecot at dovecot.org
dovecot at dovecot.org
Wed Feb 25 16:59:33 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/e7c65fa3ffa9
changeset: 18276:e7c65fa3ffa9
user: Timo Sirainen <tss at iki.fi>
date: Wed Feb 25 18:58:50 2015 +0200
description:
lib-index: Added an assert.
It seems to be triggering later on, but not sure how it's happening.
diffstat:
src/lib-index/mail-transaction-log-file.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (34 lines):
diff -r c398321df8f5 -r e7c65fa3ffa9 src/lib-index/mail-transaction-log-file.c
--- 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;
}
More information about the dovecot-cvs
mailing list