changeset 20680:eeb777a3ea85

lib-storage: Fixed istream-attachment-extractor error handling.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 23 Aug 2016 13:40:50 +0300
parents db81a0009a43
children d25763cf03f9
files src/lib-storage/index/index-attachment.c
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-attachment.c	Tue Aug 23 13:40:35 2016 +0300
+++ b/src/lib-storage/index/index-attachment.c	Tue Aug 23 13:40:50 2016 +0300
@@ -129,7 +129,7 @@
 
 static int
 index_attachment_close_ostream(struct ostream *output, bool success,
-			       const char **error_r, void *context)
+			       const char **error, void *context)
 {
 	struct mail_save_context *ctx = context;
 	struct mail_save_attachment *attach = ctx->data.attach;
@@ -138,13 +138,11 @@
 	i_assert(attach->cur_file != NULL);
 
 	if (ret < 0)
-		fs_write_stream_abort_error(attach->cur_file, &output, "write(%s) failed: %s",
-					    o_stream_get_name(output),
-					    o_stream_get_error(output));
+		fs_write_stream_abort_error(attach->cur_file, &output, "%s", *error);
 	else if (fs_write_stream_finish(attach->cur_file, &output) < 0) {
-		*error_r = t_strdup_printf("Couldn't create attachment %s: %s",
-					   fs_file_path(attach->cur_file),
-					   fs_file_last_error(attach->cur_file));
+		*error = t_strdup_printf("Couldn't create attachment %s: %s",
+					 fs_file_path(attach->cur_file),
+					 fs_file_last_error(attach->cur_file));
 		ret = -1;
 	}
 	fs_file_deinit(&attach->cur_file);