dovecot-2.2: lib-index: If map_with_read gets disabled, reset th...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Jan 5 01:14:36 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/32ce915e046a
changeset: 15567:32ce915e046a
user: Timo Sirainen <tss at iki.fi>
date: Wed Dec 19 15:00:45 2012 +0200
description:
lib-index: If map_with_read gets disabled, reset the cache buffers properly.
diffstat:
src/lib-index/mail-cache-compress.c | 8 +++++++-
src/lib-index/mail-cache.c | 1 +
2 files changed, 8 insertions(+), 1 deletions(-)
diffs (29 lines):
diff -r bde8963a3774 -r 32ce915e046a src/lib-index/mail-cache-compress.c
--- a/src/lib-index/mail-cache-compress.c Tue Dec 18 22:13:48 2012 +0200
+++ b/src/lib-index/mail-cache-compress.c Wed Dec 19 15:00:45 2012 +0200
@@ -462,7 +462,13 @@
return 0;
/* compression isn't very efficient with small read()s */
- cache->map_with_read = FALSE;
+ if (cache->map_with_read) {
+ cache->map_with_read = FALSE;
+ if (cache->read_buf != NULL)
+ buffer_set_used_size(cache->read_buf, 0);
+ cache->hdr = NULL;
+ cache->mmap_length = 0;
+ }
if (cache->index->lock_method == FILE_LOCK_METHOD_DOTLOCK) {
/* we're using dotlocking, cache file creation itself creates
diff -r bde8963a3774 -r 32ce915e046a src/lib-index/mail-cache.c
--- a/src/lib-index/mail-cache.c Tue Dec 18 22:13:48 2012 +0200
+++ b/src/lib-index/mail-cache.c Wed Dec 19 15:00:45 2012 +0200
@@ -394,6 +394,7 @@
if (offset < cache->mmap_length &&
size <= cache->mmap_length - offset) {
/* already mapped */
+ i_assert(cache->mmap_base != NULL);
*data_r = CONST_PTR_OFFSET(cache->mmap_base, offset);
return 1;
}
More information about the dovecot-cvs
mailing list