[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-uidlist.c, 1.60, 1.61

tss at dovecot.org tss at dovecot.org
Mon Mar 19 15:59:22 EET 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv31266

Modified Files:
	maildir-uidlist.c 
Log Message:
If uidlist file doesn't exist but index files do, resync the maildir to
create the uidlist.



Index: maildir-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-uidlist.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- maildir-uidlist.c	22 Feb 2007 12:50:15 -0000	1.60
+++ maildir-uidlist.c	19 Mar 2007 13:59:20 -0000	1.61
@@ -11,6 +11,7 @@
 #include "nfs-workarounds.h"
 #include "write-full.h"
 #include "maildir-storage.h"
+#include "maildir-sync.h"
 #include "maildir-uidlist.h"
 
 #include <stdio.h>
@@ -467,8 +468,19 @@
 	unsigned int idx;
 
 	rec = maildir_uidlist_lookup_rec(uidlist, uid, &idx);
-	if (rec == NULL)
-		return NULL;
+	if (rec == NULL) {
+		if (uidlist->last_mtime != 0)
+			return NULL;
+
+		/* the uidlist doesn't exist. */
+		if (maildir_storage_sync_force(uidlist->mbox) < 0)
+			return NULL;
+
+		/* try again */
+		rec = maildir_uidlist_lookup_rec(uidlist, uid, &idx);
+		if (rec == NULL)
+			return NULL;
+	}
 
 	*flags_r = rec->flags;
 	return rec->filename;



More information about the dovecot-cvs mailing list