Mercurial > dovecot > core-2.2
changeset 18873:21c0ffec1d2b
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 17 Jun 2015 12:21:52 +0300 |
parents | e7c896eff939 |
children | 343602625064 |
files | src/lib-fs/fs-api.c |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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;