[dovecot-cvs] dovecot/src/lib file-dotlock.c,1.36,1.37

cras at dovecot.org cras at dovecot.org
Thu Jun 8 19:41:32 EEST 2006


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

Modified Files:
	file-dotlock.c 
Log Message:
When checking if we want to override dotlocks, don't use the
file-to-be-locked file's mtime if it's higher than current time.



Index: file-dotlock.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/file-dotlock.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- file-dotlock.c	8 Jun 2006 16:39:28 -0000	1.36
+++ file-dotlock.c	8 Jun 2006 16:41:30 -0000	1.37
@@ -114,8 +114,12 @@
 		time_t change_time = now;
 
 		if (change->ctime == 0) {
-			/* first check, set last_change to file's change time */
-			change_time = I_MAX(st->st_ctime, st->st_mtime);
+			/* First check, set last_change to file's change time.
+			   Use mtime instead if it's higher, but only if it's
+			   not higher than current time, because the mtime
+			   can also be used for keeping metadata. */
+			change_time = st->st_mtime > now ? st->st_ctime :
+				I_MAX(st->st_ctime, st->st_mtime);
 		}
 		if (*last_change_r < change_time)
 			*last_change_r = change_time;



More information about the dovecot-cvs mailing list