[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.98, 1.99

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


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

Modified Files:
	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.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- mbox-save.c	2 Aug 2006 00:16:18 -0000	1.98
+++ mbox-save.c	10 Aug 2006 21:40:48 -0000	1.99
@@ -588,6 +588,7 @@
 
 int mbox_transaction_save_commit(struct mbox_save_context *ctx)
 {
+	struct stat st;
 	int ret = 0;
 
 	i_assert(ctx->finished);
@@ -596,6 +597,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