]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir: Convert dovecot-uidlist files to new format immediately when
authorTimo Sirainen <tss@iki.fi>
Sat, 21 Jun 2008 12:53:43 +0000 (15:53 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 21 Jun 2008 12:53:43 +0000 (15:53 +0300)
opening them. Without this it's possible that entries are appended to old
format uidlist in the new format.

--HG--
branch : HEAD

src/lib-storage/index/maildir/maildir-uidlist.c

index f9b296430b27410eb96cfdd7e38ae741c1c01609..1a70a9962429f0818fd87d354a41f4313c1ef72c 100644 (file)
@@ -323,6 +323,16 @@ static void maildir_uidlist_update_hdr(struct maildir_uidlist *uidlist,
        }
 
        mhdr = &uidlist->mbox->maildir_hdr;
+       if (mhdr->uidlist_mtime == 0) {
+               if (!uidlist->initial_read)
+                       (void)maildir_uidlist_refresh(uidlist);
+               if (uidlist->version != UIDLIST_VERSION) {
+                       /* upgrading from older verson. don't update the
+                          uidlist times until it uses the new format */
+                       uidlist->recreate = TRUE;
+                       return;
+               }
+       }
        mhdr->uidlist_mtime = st->st_mtime;
        mhdr->uidlist_mtime_nsecs = ST_MTIME_NSEC(*st);
        mhdr->uidlist_size = st->st_size;