changeset 7490:e935b36b8b65 HEAD

mbox: Always update sync_size when saving mails. We rely on sync_size for getting the last message's physical size.
author Timo Sirainen <tss@iki.fi>
date Sun, 04 May 2008 22:05:21 +0300
parents 80d827b411c8
children 33d6be3b5c01
files src/lib-storage/index/mbox/mbox-save.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 
 		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;
 	}