# HG changeset patch # User Timo Sirainen # Date 1031629258 -10800 # Node ID e506203cffa48f82600a54e1de969da14a0b7d4b # Parent b426c07093d381b215d6225dd9be3da0a16acce9 expunge() shouldn't update mmap, since we could be just going through the index records. diff -r b426c07093d3 -r e506203cffa4 src/lib-index/mail-index.c --- a/src/lib-index/mail-index.c Tue Sep 10 06:35:50 2002 +0300 +++ b/src/lib-index/mail-index.c Tue Sep 10 06:40:58 2002 +0300 @@ -962,6 +962,7 @@ i_assert(!index->dirty_mmap); i_assert(index->lock_type != MAIL_LOCK_UNLOCK); + i_assert(rec >= (MailIndexRecord *) index->mmap_base); if (rec == NULL) return NULL; @@ -1235,20 +1236,18 @@ static int mail_index_truncate(MailIndex *index) { - if (msync(index->mmap_base, index->mmap_length, MS_SYNC) == -1) { - index_set_error(index, "msync() failed for %s: %m", - index->filepath); - return FALSE; - } + off_t file_size; /* truncate index file */ - if (ftruncate(index->fd, - (off_t)index->header->first_hole_position) < 0) { + file_size = (off_t)index->header->first_hole_position; + if (ftruncate(index->fd, file_size) < 0) { index_set_error(index, "ftruncate() failed for index file " "%s: %m", index->filepath); return FALSE; } + index->mmap_length = (size_t)file_size; + /* update header */ index->header->first_hole_position = 0; index->header->first_hole_records = 0; @@ -1260,10 +1259,6 @@ return FALSE; } - index->dirty_mmap = TRUE; - if (!mmap_update(index)) - return FALSE; - return TRUE; }