# HG changeset patch # User Timo Sirainen # Date 1287414848 -3600 # Node ID 0dae63c1af96bf963ed00a3fbfd87688693c6722 # Parent 7b47c5a321b980abc9616de34bf7445fa107a304 lib-index: More undoing of locking code changes. diff -r 7b47c5a321b9 -r 0dae63c1af96 src/lib-index/mail-index-lock.c --- a/src/lib-index/mail-index-lock.c Mon Oct 18 16:07:17 2010 +0100 +++ b/src/lib-index/mail-index-lock.c Mon Oct 18 16:14:08 2010 +0100 @@ -74,9 +74,15 @@ return 1; } - i_assert(index->file_lock == NULL); - ret = mail_index_lock_fd(index, index->filepath, index->fd, - lock_type, timeout_secs, &index->file_lock); + if (index->file_lock == NULL) { + i_assert(index->lock_type == F_UNLCK); + ret = mail_index_lock_fd(index, index->filepath, index->fd, + lock_type, timeout_secs, + &index->file_lock); + } else { + i_assert(index->lock_type == F_RDLCK && lock_type == F_WRLCK); + ret = file_lock_try_update(index->file_lock, lock_type); + } if (ret <= 0) return ret;