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(file, output);
}
fs_set_error_async(dest->fs);
return -1;
case OSTREAM_SEND_ISTREAM_RESULT_ERROR_INPUT:
- 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;
case OSTREAM_SEND_ISTREAM_RESULT_ERROR_OUTPUT:
- 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;
}
_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;
}