aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-data-wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-data-wrapper.c')
-rw-r--r--camel/camel-data-wrapper.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/camel/camel-data-wrapper.c b/camel/camel-data-wrapper.c
index 8fc258ac24..7110adcc60 100644
--- a/camel/camel-data-wrapper.c
+++ b/camel/camel-data-wrapper.c
@@ -236,6 +236,7 @@ my_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
{
gchar tmp_buf[4096];
gint nb_read;
+ gint nb_written;
CamelStream *output_stream;
/*
@@ -249,8 +250,9 @@ my_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
while (!camel_stream_eos (output_stream)) {
nb_read = camel_stream_read (output_stream, tmp_buf, 4096);
- if (nb_read)
- camel_stream_write (stream, tmp_buf, nb_read);
+ nb_written = 0;
+ while (nb_written < nb_read)
+ nb_written += camel_stream_write (stream, tmp_buf, nb_read);
}
}