changeset 2379:9a6d22b5bb7a HEAD

mbox corruption fix
author Timo Sirainen <tss@iki.fi>
date Fri, 30 Jul 2004 04:03:59 +0300
parents 00a4d69a1d1c
children 4e42d4213927
files src/lib-storage/index/mbox/mbox-sync-rewrite.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Wed Jul 28 19:31:54 2004 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Fri Jul 30 04:03:59 2004 +0300
@@ -108,11 +108,14 @@
 	/* pos points to end of header now, and start_pos to beginning
 	   of whitespace. */
 
-	if (/*size > 1024 && */skip_space_pos_r != NULL) {
+	if (size > 1024 && skip_space_pos_r != NULL) {
 		/* we're rewriting messages and moving space towards beginning
 		   of file. it's useless to write lots of spaces because we're
 		   overwriting it soon anyway. */
 		*skip_space_pos_r = start_pos;
+
+		/* we'll have to delete the existing space */
+		buffer_delete(ctx->header, start_pos, pos - start_pos);
 	} else {
 		if (skip_space_pos_r != NULL)
 			*skip_space_pos_r = (size_t)-1;