[dovecot-cvs] dovecot/src/lib-index mail-index-lock.c,1.27,1.28

cras at dovecot.org cras at dovecot.org
Fri Sep 3 23:31:24 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv28917/lib-index

Modified Files:
	mail-index-lock.c 
Log Message:
lock fix



Index: mail-index-lock.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-lock.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- mail-index-lock.c	3 Sep 2004 19:55:35 -0000	1.27
+++ mail-index-lock.c	3 Sep 2004 20:31:22 -0000	1.28
@@ -74,18 +74,21 @@
 	}
 
 	if (update_index && index->excl_lock_count == 0) {
+		i_assert(index->lock_type != F_WRLCK);
 		if ((ret2 = mail_index_refresh(index)) < 0)
 			return -1;
 		if (ret > 0 && ret2 == 0) {
-			if (mail_index_lock_mprotect(index, lock_type) < 0)
+			if (mail_index_lock_mprotect(index,
+						     index->lock_type) < 0)
 				return -1;
 			return 1;
 		}
 		ret = 0;
 	}
 
-	if (ret > 0)
+	if (ret > 0) {
 		return 1;
+	}
 
 	if (index->fcntl_locks_disable) {
 		/* FIXME: exclusive locking will rewrite the index file every
@@ -319,6 +322,7 @@
 
 	if (index->shared_lock_count > 0 && !index->fcntl_locks_disable) {
 		/* leave ourself shared locked. */
+		index->lock_type = F_RDLCK;
 		if (file_try_lock(index->fd, F_RDLCK) <= 0) {
 			mail_index_file_set_syscall_error(index,
 							  index->copy_lock_path,



More information about the dovecot-cvs mailing list