changeset 6088:7639a6df4acb HEAD

When rewriting a directory, make sure the write buffers are zeroed before doing anything.
author Timo Sirainen <tss@iki.fi>
date Thu, 19 Jul 2007 02:13:44 +0300
parents f479a774a416
children a19931ec66db
files src/lib-index/mailbox-list-index-sync.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mailbox-list-index-sync.c	Thu Jul 19 01:57:47 2007 +0300
+++ b/src/lib-index/mailbox-list-index-sync.c	Thu Jul 19 02:13:44 2007 +0300
@@ -501,7 +501,7 @@
 
 	if (ctx->index->mmap_disable) {
 		/* write the data into temporary buffer first */
-		buffer_set_used_size(ctx->output_buf, 0);
+		buffer_reset(ctx->output_buf);
 
 		if (ctx->output->offset != pos) {
 			i_assert(pos > ctx->output->offset &&
@@ -520,6 +520,7 @@
 			i_assert(pos + size < ctx->index->mmap_size);
 		}
 		*base_r = PTR_OFFSET(ctx->index->mmap_base, pos);
+		memset(*base_r, 0, size);
 	}
 
 	*base_offset_r = pos;