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

cras at dovecot.org cras at dovecot.org
Fri Oct 28 17:01:32 EEST 2005


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

Modified Files:
	mbox-sync-rewrite.c 
Log Message:
Set mail_ctx=NULL always after doing something for the last mail, even if we
didn't rewrite its headers. Otherwise internal state breaks and we'll crash.



Index: mbox-sync-rewrite.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- mbox-sync-rewrite.c	27 Oct 2005 12:12:57 -0000	1.55
+++ mbox-sync-rewrite.c	28 Oct 2005 14:01:28 -0000	1.56
@@ -375,6 +375,7 @@
 				    expunged_space);
 		mail_ctx = &new_mail_ctx;
 	} else {
+		i_assert(seq == mail_ctx->seq);
 		if (mail_ctx->mail.space < 0)
 			mail_ctx->mail.space = 0;
 	}
@@ -500,7 +501,6 @@
 				ret = -1;
 				break;
 			}
-			mail_ctx = NULL;
 			move_diff -= next_move_diff + mails[idx].space;
 		} else {
 			/* this mail provides more space. just move it forward
@@ -534,6 +534,7 @@
 			}
 			mails[idx].offset += move_diff;
 		}
+		mail_ctx = NULL;
 
 		i_assert(move_diff >= 0 || idx == first_nonexpunged_idx);
 		i_assert(next_end_offset <= end_offset);



More information about the dovecot-cvs mailing list