aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-filter.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-02-05 08:12:07 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-02-05 08:12:07 +0800
commitf735b43e8e3622ff58b3e03d573d671755606966 (patch)
tree09a64fd4de5c03ca6079a5f15a764d1e5900c243 /camel/camel-stream-filter.c
parent66a509fb9d9a452b6f5f9f74e0c7209b221e8c54 (diff)
downloadgsoc2013-evolution-f735b43e8e3622ff58b3e03d573d671755606966.tar.gz
gsoc2013-evolution-f735b43e8e3622ff58b3e03d573d671755606966.tar.zst
gsoc2013-evolution-f735b43e8e3622ff58b3e03d573d671755606966.zip
Make do_write loop until the entire buffer is written.
2001-02-04 Jeffrey Stedfast <fejj@ximian.com> * camel-stream-filter.c (do_write): Make do_write loop until the entire buffer is written. svn path=/trunk/; revision=7963
Diffstat (limited to 'camel/camel-stream-filter.c')
-rw-r--r--camel/camel-stream-filter.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
index 866c8d2416..1189262ddc 100644
--- a/camel/camel-stream-filter.c
+++ b/camel/camel-stream-filter.c
@@ -269,6 +269,7 @@ do_write (CamelStream *stream, const char *buf, size_t n)
CamelStreamFilter *filter = (CamelStreamFilter *)stream;
struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
struct _filter *f;
+ ssize_t w, written = 0;
int presize;
char *buffer = (char *)buf;
size_t len = n;
@@ -291,10 +292,13 @@ do_write (CamelStream *stream, const char *buf, size_t n)
f = f->next;
}
-
- if (camel_stream_write(filter->source, buffer, len) != len)
- return -1;
-
+
+ do {
+ w = camel_stream_write (filter->source, buffer + written, len - written);
+ if (w > 0)
+ written += w;
+ } while (written < len);
+
return n;
}