From: Timo Sirainen Date: Sun, 20 Jun 2004 04:23:16 +0000 (+0300) Subject: assertfix X-Git-Tag: 1.1.alpha1~3913 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c24d47ad5ff02ea00684233bef314ef2eefda4a;p=thirdparty%2Fdovecot%2Fcore.git assertfix --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index.c b/src/lib-index/mail-index.c index 584327129e..0225aa59d0 100644 --- a/src/lib-index/mail-index.c +++ b/src/lib-index/mail-index.c @@ -199,7 +199,13 @@ static int mail_index_mmap(struct mail_index *index, struct mail_index_map *map) const struct mail_index_header *hdr; unsigned int records_count; - i_assert(map->buffer == NULL); + i_assert(!map->write_to_disk); + + if (map->buffer != NULL) { + /* we had temporarily used a buffer, eg. for updating index */ + buffer_free(map->buffer); + map->buffer = NULL; + } map->mmap_base = index->lock_type != F_WRLCK ? mmap_ro_file(index->fd, &map->mmap_size) : @@ -352,6 +358,7 @@ int mail_index_map(struct mail_index *index, int force) /* FIXME: we need to re-read header */ } else if (map->mmap_base != NULL) { /* see if re-mmaping is needed (file has grown) */ + i_assert(map->buffer == NULL); hdr = map->mmap_base; /* always check corrupted-flag to avoid errors later */