diff src/lib-storage/index/dbox-single/sdbox-file.c @ 20264:0fd0fb05e2b3

global: Use [io]_stream_get_error() insted of %m
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 16 May 2016 15:49:08 +0300
parents 389c5094c2a8
children bb081fa224e0
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-single/sdbox-file.c	Tue May 10 20:37:55 2016 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-file.c	Mon May 16 15:49:08 2016 +0300
@@ -328,20 +328,15 @@
 
 	output = o_stream_create_fd_file(out_fd, 0, FALSE);
 	i_stream_seek(file->input, 0);
-	while ((ret = o_stream_send_istream(output, file->input)) > 0) ;
+	ret = o_stream_send_istream(output, file->input) > 0 ? 0 : -1;
 	if (o_stream_nfinish(output) < 0) {
-		mail_storage_set_critical(storage, "write(%s) failed: %m",
-					  temp_path);
+		mail_storage_set_critical(storage, "write(%s) failed: %s",
+			temp_path, o_stream_get_error(output));
 		ret = -1;
 	} else if (file->input->stream_errno != 0) {
-		errno = file->input->stream_errno;
-		dbox_file_set_syscall_error(file, "ftruncate()");
+		mail_storage_set_critical(storage, "read(%s) failed: %s",
+			temp_path, i_stream_get_error(file->input));
 		ret = -1;
-	} else if (ret < 0) {
-		mail_storage_set_critical(storage,
-			"o_stream_send_istream(%s, %s) "
-			"failed with unknown error",
-			temp_path, file->cur_path);
 	}
 	o_stream_unref(&output);