[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-rewrite.c, 1.32, 1.33

cras at dovecot.org cras at dovecot.org
Tue Oct 5 23:40:55 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv7057/lib-storage/index/mbox

Modified Files:
	mbox-sync-rewrite.c 
Log Message:
crashfix



Index: mbox-sync-rewrite.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- mbox-sync-rewrite.c	5 Oct 2004 00:26:40 -0000	1.32
+++ mbox-sync-rewrite.c	5 Oct 2004 20:40:52 -0000	1.33
@@ -320,7 +320,9 @@
 		(mail_ctx.body_offset - mail_ctx.hdr_offset);
 	i_assert(need_space == (uoff_t)-mails[idx].space);
 
-	if (padding < (uoff_t)mail_ctx.mail.space) {
+	if (mail_ctx.mail.space == 0) {
+		/* don't touch spacing */
+	} else if (padding < (uoff_t)mail_ctx.mail.space) {
 		mbox_sync_headers_remove_space(&mail_ctx, mail_ctx.mail.space -
 					       padding);
 	} else {
@@ -348,7 +350,6 @@
 	mails[idx].offset = dest_offset +
 		(mail_ctx.mail.offset - mail_ctx.hdr_offset);
 	mails[idx].space = mail_ctx.mail.space;
-	i_assert(mails[idx].space == padding);
 
 	if (mails[idx].from_offset == 0) {
 		sync_ctx->base_uid_last =
@@ -407,7 +408,7 @@
 		if (mails[idx].space <= 0 &&
 		    (mails[idx].flags & MBOX_EXPUNGED) == 0) {
 			/* give space to this mail */
-			next_move_diff = -mails[idx].space + padding_per_mail;
+			next_move_diff = -mails[idx].space;
 			if (mbox_sync_read_and_move(sync_ctx, mails,
 						    first_seq + idx, idx,
 						    padding_per_mail, move_diff,
@@ -415,7 +416,7 @@
 				ret = -1;
 				break;
 			}
-			move_diff -= next_move_diff;
+			move_diff -= next_move_diff + mails[idx].space;
 		} else {
 			/* this mail provides more space. just move it forward
 			   from the extra space offset and set end_offset to



More information about the dovecot-cvs mailing list