[dovecot-cvs] dovecot/src/lib file-dotlock.c,1.35.2.1,1.35.2.2

cras at dovecot.org cras at dovecot.org
Thu May 11 14:47:55 EEST 2006


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

Modified Files:
      Tag: branch_1_0
	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.35.2.1
retrieving revision 1.35.2.2
diff -u -d -r1.35.2.1 -r1.35.2.2
--- file-dotlock.c	10 May 2006 11:24:20 -0000	1.35.2.1
+++ file-dotlock.c	11 May 2006 11:47:53 -0000	1.35.2.2
@@ -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