dovecot-2.2: lib-fs: Call o_stream_nfinish() automatically for a...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 17 09:24:55 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/21c0ffec1d2b
changeset: 18873:21c0ffec1d2b
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 17 12:21:52 2015 +0300
description:
lib-fs: Call o_stream_nfinish() automatically for all backends in fs_write_stream_finish()
Otherwise each backend needs to do it internally. fs-metawrap for example
was missing this and causing assert-crashes.

diffstat:

 src/lib-fs/fs-api.c |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r e7c896eff939 -r 21c0ffec1d2b src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c	Wed Jun 17 11:42:53 2015 +0300
+++ b/src/lib-fs/fs-api.c	Wed Jun 17 12:21:52 2015 +0300
@@ -557,14 +557,23 @@
 int fs_write_stream_finish(struct fs_file *file, struct ostream **output)
 {
 	int ret;
+	bool success = TRUE;
 
 	i_assert(*output == file->output || *output == NULL);
 
 	*output = NULL;
 	if (file->output != NULL)
 		o_stream_uncork(file->output);
+	if (file->output != NULL) {
+		if (o_stream_nfinish(file->output) < 0) {
+			fs_set_error(file->fs, "write(%s) failed: %s",
+				     o_stream_get_name(file->output),
+				     o_stream_get_error(file->output));
+			success = FALSE;
+		}
+	}
 	T_BEGIN {
-		ret = file->fs->v.write_stream_finish(file, TRUE);
+		ret = file->fs->v.write_stream_finish(file, success);
 	} T_END;
 	if (ret != 0)
 		file->metadata_changed = FALSE;


More information about the dovecot-cvs mailing list