aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-stream-filter.c12
-rw-r--r--camel/camel-stream-fs.c4
3 files changed, 15 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 11400e8684..c3f6c2de8b 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2001-02-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-stream-filter.c (do_write): Make do_write loop until the
+ entire buffer is written.
+
2001-02-02 Not Zed <NotZed@Ximian.com>
* camel-stream-fs.c: Add missing header for cancel check stuff.
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;
}
diff --git a/camel/camel-stream-fs.c b/camel/camel-stream-fs.c
index 95778de63c..599d06cf7a 100644
--- a/camel/camel-stream-fs.c
+++ b/camel/camel-stream-fs.c
@@ -287,7 +287,7 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
FD_ZERO(&wrset);
FD_SET(stream_fs->fd, &wrset);
FD_SET(cancel_fd, &rdset);
- fdmax = MAX(stream_fs->fd, cancel_fd)+1;
+ fdmax = MAX(stream_fs->fd, cancel_fd)+1;
select(fdmax, &rdset, &wrset, 0, NULL);
if (FD_ISSET(cancel_fd, &rdset)) {
fcntl(stream_fs->fd, F_SETFL, flags);
@@ -320,7 +320,7 @@ stream_close (CamelStream *stream)
if (close (((CamelStreamFs *)stream)->fd) == -1)
return -1;
- ((CamelStreamFs *)stream)->fd= -1;
+ ((CamelStreamFs *)stream)->fd = -1;
return 0;
}