]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
expunge/append behaviour corrupted indexes
authorTimo Sirainen <tss@iki.fi>
Sun, 24 Aug 2003 06:32:08 +0000 (09:32 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 24 Aug 2003 06:32:08 +0000 (09:32 +0300)
--HG--
branch : HEAD

src/lib-index/mail-index-file.c
src/lib-index/mail-index.c

index 3f9a3a0fbc558e1f804255dab9b84f543e69f090..e86b6589817ab7d313d257d681ff2bd5bbe5b3b5 100644 (file)
@@ -31,6 +31,11 @@ static int compress(struct mail_index *index, unsigned int remove_first_idx,
        index->header->used_file_size -= sizeof(*rec) * count;
        index->mmap_used_length -= sizeof(*rec) * count;
 
+       /* not really needed since append() will initialize it as well,
+          but may help preventing problems if change is only partially
+          written to disk */
+       memset((char *) rec + index->mmap_used_length, 0, sizeof(*rec) * count);
+
        return mail_index_truncate(index);
 }
 
index 086d83efaaf543f3e2394b046170547cc9fd7971..f876a696fe3056280611f2eda03e1318e82ba921 100644 (file)
@@ -680,6 +680,7 @@ struct mail_index_record *mail_index_append(struct mail_index *index)
                                            index->mmap_used_length);
        rec->uid = index->header->next_uid++;
        rec->msg_flags = 0;
+       rec->cache_offset = 0;
 
        index->header->used_file_size += sizeof(*rec);
        index->mmap_used_length += sizeof(*rec);