Mercurial > dovecot > core-2.2
changeset 20681:d25763cf03f9
lib-fs: Fixes to previous fs_write_stream_abort*() changes.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 23 Aug 2016 13:41:38 +0300 |
parents | eeb777a3ea85 |
children | 2acf5c44444c |
files | src/lib-fs/fs-api.c src/lib-fs/fs-randomfail.c |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-fs/fs-api.c Tue Aug 23 13:40:50 2016 +0300 +++ b/src/lib-fs/fs-api.c Tue Aug 23 13:41:38 2016 +0300 @@ -737,7 +737,7 @@ void fs_write_stream_abort_parent(struct fs_file *file, struct ostream **output) { i_assert(file->parent != NULL); - i_assert(fs_filelast_error(file->parent) != NULL); + i_assert(fs_file_last_error(file->parent) != NULL); fs_write_stream_abort_int(file, output); } @@ -908,20 +908,20 @@ } while (o_stream_send_istream(dest->copy_output, dest->copy_input) > 0) ; if (dest->copy_input->stream_errno != 0) { - errno = dest->copy_input->stream_errno; fs_write_stream_abort_error(dest, &dest->copy_output, "read(%s) failed: %s", i_stream_get_name(dest->copy_input), i_stream_get_error(dest->copy_input)); + errno = dest->copy_input->stream_errno; i_stream_unref(&dest->copy_input); return -1; } if (dest->copy_output->stream_errno != 0) { - errno = dest->copy_output->stream_errno; fs_write_stream_abort_error(dest, &dest->copy_output, "write(%s) failed: %s", o_stream_get_name(dest->copy_output), o_stream_get_error(dest->copy_output)); + errno = dest->copy_output->stream_errno; i_stream_unref(&dest->copy_input); return -1; }
--- a/src/lib-fs/fs-randomfail.c Tue Aug 23 13:40:50 2016 +0300 +++ b/src/lib-fs/fs-randomfail.c Tue Aug 23 13:41:38 2016 +0300 @@ -403,7 +403,11 @@ _file->output = NULL; else o_stream_unref(&_file->output); - if (!success || fs_random_fail(_file->fs, 1, FS_OP_WRITE)) { + if (!success) { + fs_write_stream_abort_parent(_file->parent, &file->super_output); + return -1; + } + if (!fs_random_fail(_file->fs, 1, FS_OP_WRITE)) { fs_write_stream_abort_error(file->super, &file->super_output, RANDOMFAIL_ERROR); return -1; }