dovecot-2.0: mbox: Write the last LF before fdatasync().

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 16 22:30:36 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/003a21d9e826
changeset: 10088:003a21d9e826
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 16 15:30:29 2009 -0400
description:
mbox: Write the last LF before fdatasync().

diffstat:

1 file changed, 4 insertions(+)
src/lib-storage/index/mbox/mbox-save.c |    4 ++++

diffs (14 lines):

diff -r b3c3675ba466 -r 003a21d9e826 src/lib-storage/index/mbox/mbox-save.c
--- a/src/lib-storage/index/mbox/mbox-save.c	Fri Oct 16 15:20:26 2009 -0400
+++ b/src/lib-storage/index/mbox/mbox-save.c	Fri Oct 16 15:30:29 2009 -0400
@@ -775,6 +775,10 @@ int mbox_transaction_save_commit_pre(str
 			mbox_set_syscall_error(mbox, "utime()");
 	}
 
+	if (ctx->output != NULL) {
+		/* flush the final LF */
+		o_stream_flush(ctx->output);
+	}
 	if (mbox->mbox_fd != -1 && !mbox->mbox_writeonly &&
 	    !mbox->storage->storage.set->fsync_disable) {
 		if (fdatasync(mbox->mbox_fd) < 0) {


More information about the dovecot-cvs mailing list