]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
some opening fixes
authorTimo Sirainen <tss@iki.fi>
Mon, 11 Aug 2003 14:28:27 +0000 (17:28 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 11 Aug 2003 14:28:27 +0000 (17:28 +0300)
--HG--
branch : HEAD

src/lib-index/mail-cache.c
src/lib-index/mail-index-open.c

index ee8fd56b1e41c98c4082374b975e4dcda152ffe7..f3e269789d87fddf3790315c64f4b2399b04b5cb 100644 (file)
@@ -199,7 +199,10 @@ static int mail_cache_file_reopen(struct mail_cache *cache)
 {
        int fd;
 
-       i_assert(!cache->anon_mmap);
+       if (cache->anon_mmap) {
+               /* cache was set corrupted, we'll have to quit */
+               return FALSE;
+       }
 
        fd = open(cache->filepath, O_RDWR);
        if (fd == -1)
index 974a85fa47c983a46484acede3c62aca448e86fd..55cee26d2a78afc4e6e0e175fcdb94043bb67109 100644 (file)
@@ -297,9 +297,11 @@ static int mail_index_open_index(struct mail_index *index,
 
        if ((ret = mail_index_read_header(index, &hdr)) < 0)
                return FALSE;
+       index->indexid = hdr.indexid;
 
        if (ret == 0 || hdr.major_version != MAIL_INDEX_MAJOR_VERSION ||
-           (hdr.flags & MAIL_INDEX_HDR_FLAG_REBUILD) != 0) {
+           (hdr.flags & MAIL_INDEX_HDR_FLAG_REBUILD) != 0 ||
+           !mail_index_mmap_update(index)) {
                if ((flags & MAIL_INDEX_OPEN_FLAG_CREATE) == 0)
                        return FALSE;
 
@@ -318,11 +320,6 @@ static int mail_index_open_index(struct mail_index *index,
                        return FALSE;
        }
 
-       index->indexid = hdr.indexid;
-
-       if (!mail_index_mmap_update(index))
-               return FALSE;
-
        if (index->lock_type == MAIL_LOCK_SHARED) {
                /* we don't want to keep the shared lock while opening
                   indexes. opening should work unlocked and some