aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-stream-buffer.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 88bfb7cb30..67442996ed 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,10 @@
2004-06-04 Jeffrey Stedfast <fejj@novell.com>
+ * camel-stream-buffer.c (stream_flush): Fixed to work
+ properly. After we've flushed the buffer, we want to set sbf->ptr
+ to sbf->buf, we don't want to do sbf->ptr += written, that'll just
+ corrupt our next write.
+
* providers/imap4/camel-imap4-store.c (connect_to_server_wrapper):
Duh. If the user doesn't care about SSL/TLS - use USE_SSL_NEVER,
not USE_SSL_ALWAYS.
diff --git a/camel/camel-stream-buffer.c b/camel/camel-stream-buffer.c
index 8051441ae7..5db1c124f5 100644
--- a/camel/camel-stream-buffer.c
+++ b/camel/camel-stream-buffer.c
@@ -333,12 +333,12 @@ stream_flush (CamelStream *stream)
CamelStreamBuffer *sbf = CAMEL_STREAM_BUFFER (stream);
if ((sbf->mode & CAMEL_STREAM_BUFFER_MODE) == CAMEL_STREAM_BUFFER_WRITE) {
- int len = sbf->ptr-sbf->buf;
- int written = camel_stream_write(sbf->stream, sbf->buf, len);
- if (written > 0)
- sbf->ptr += written;
- if (written != len)
+ size_t len = sbf->ptr - sbf->buf;
+
+ if (camel_stream_write (sbf->stream, sbf->buf, len) == -1)
return -1;
+
+ sbf->ptr = sbf->buf;
} else {
/* nothing to do for read mode 'flush' */
}