From: Timo Sirainen Date: Sun, 24 Aug 2003 06:32:08 +0000 (+0300) Subject: expunge/append behaviour corrupted indexes X-Git-Tag: 1.1.alpha1~4387 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f16b058c2ea114f8e6887c06f797e7be6d04d3fb;p=thirdparty%2Fdovecot%2Fcore.git expunge/append behaviour corrupted indexes --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index-file.c b/src/lib-index/mail-index-file.c index 3f9a3a0fbc..e86b658981 100644 --- a/src/lib-index/mail-index-file.c +++ b/src/lib-index/mail-index-file.c @@ -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); } diff --git a/src/lib-index/mail-index.c b/src/lib-index/mail-index.c index 086d83efaa..f876a696fe 100644 --- a/src/lib-index/mail-index.c +++ b/src/lib-index/mail-index.c @@ -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);