[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.94.2.2, 1.94.2.3

cras at dovecot.org cras at dovecot.org
Fri Aug 11 00:40:49 EEST 2006


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

Modified Files:
      Tag: branch_1_0
	mbox-save.c 
Log Message:
After saving a mail with index being in synced state, update the sync_stamp
and sync_size fields in the index so that it actually stays synced.



Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.94.2.2
retrieving revision 1.94.2.3
diff -u -d -r1.94.2.2 -r1.94.2.3
--- mbox-save.c	2 Aug 2006 00:16:17 -0000	1.94.2.2
+++ mbox-save.c	10 Aug 2006 21:40:46 -0000	1.94.2.3
@@ -595,6 +595,7 @@
 
 int mbox_transaction_save_commit(struct mbox_save_context *ctx)
 {
+	struct stat st;
 	int ret = 0;
 
 	i_assert(ctx->finished);
@@ -603,6 +604,21 @@
 		mail_index_update_header(ctx->trans,
 			offsetof(struct mail_index_header, next_uid),
 			&ctx->next_uid, sizeof(ctx->next_uid), FALSE);
+
+		if (fstat(ctx->mbox->mbox_fd, &st) < 0) {
+			mbox_set_syscall_error(ctx->mbox, "fstat()");
+			ret = -1;
+		} else {
+			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);
+			mail_index_update_header(ctx->trans,
+				offsetof(struct mail_index_header, sync_size),
+				&sync_size, sizeof(sync_size), TRUE);
+		}
 	}
 
 	if (!ctx->synced && ctx->mbox->mbox_fd != -1 &&



More information about the dovecot-cvs mailing list