dovecot-1.1: mbox: Always update sync_size when saving mails. We...

dovecot at dovecot.org dovecot at dovecot.org
Sun May 4 22:05:25 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/e935b36b8b65
changeset: 7490:e935b36b8b65
user:      Timo Sirainen <tss at iki.fi>
date:      Sun May 04 22:05:21 2008 +0300
description:
mbox: Always update sync_size when saving mails. We rely on sync_size for
getting the last message's physical size.

diffstat:

1 file changed, 6 insertions(+), 2 deletions(-)
src/lib-storage/index/mbox/mbox-save.c |    8 ++++++--

diffs (26 lines):

diff -r 80d827b411c8 -r e935b36b8b65 src/lib-storage/index/mbox/mbox-save.c
--- a/src/lib-storage/index/mbox/mbox-save.c	Sun May 04 21:55:41 2008 +0300
+++ b/src/lib-storage/index/mbox/mbox-save.c	Sun May 04 22:05:21 2008 +0300
@@ -720,16 +720,20 @@ int mbox_transaction_save_commit(struct 
 
 		if (!ctx->mbox->mbox_sync_dirty && ret == 0) {
 			uint32_t sync_stamp = st.st_mtime;
-			uint64_t sync_size = st.st_size;
 
 			mail_index_update_header(ctx->trans,
 				offsetof(struct mail_index_header, sync_stamp),
 				&sync_stamp, sizeof(sync_stamp), TRUE);
+		}
+		if (ret == 0) {
+			/* sync_size is used in calculating the last message's
+			   size. it must be up-to-date. */
+			uint64_t sync_size = st.st_size;
+
 			mail_index_update_header(ctx->trans,
 				offsetof(struct mail_index_header, sync_size),
 				&sync_size, sizeof(sync_size), TRUE);
 		}
-
 		*t->ictx.last_saved_uid = ctx->next_uid - 1;
 	}
 


More information about the dovecot-cvs mailing list