changeset 3704:83b65734e32e HEAD

If mail had more extra space in X-UID header than in X-Keywords header (but X-Keywords existed), we broke when rewriting it.
author Timo Sirainen <tss@iki.fi>
date Fri, 28 Oct 2005 18:18:50 +0300
parents 736583a848a9
children 561e81dfa20b
files src/lib-storage/index/mbox/mbox-sync-rewrite.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Fri Oct 28 17:48:29 2005 +0300
+++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c	Fri Oct 28 18:18:50 2005 +0300
@@ -88,7 +88,12 @@
 
 	if (ctx->pseudo)
 		start_pos = ctx->hdr_pos[MBOX_HDR_X_IMAPBASE];
-	else {
+	else if (ctx->mail.space > 0) {
+		/* update the header using the existing offset.
+		   otherwise we might chose wrong header and just decrease
+		   the available space */
+		start_pos = ctx->mail.offset - ctx->hdr_offset;
+	} else {
 		/* Append at the end of X-Keywords header,
 		   or X-UID if it doesn't exist */
 		start_pos = ctx->hdr_pos[MBOX_HDR_X_KEYWORDS] != (size_t)-1 ?