changeset 2458:346fe259a18c HEAD

send_istream() didn't work properly.
author Timo Sirainen <tss@iki.fi>
date Sun, 22 Aug 2004 14:19:52 +0300
parents 5506d4cd4973
children b7a76368fdad
files src/lib/ostream-crlf.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ostream-crlf.c	Sun Aug 22 14:08:58 2004 +0300
+++ b/src/lib/ostream-crlf.c	Sun Aug 22 14:19:52 2004 +0300
@@ -236,14 +236,16 @@
 _send_istream(struct _ostream *outstream, struct istream *instream)
 {
 	struct const_iovec iov;
+        const unsigned char *data;
 	size_t sent = 0;
 	ssize_t ret;
 
-	while ((ret = i_stream_read(instream)) != -1) {
-		if (ret == 0)
+	while ((ret = i_stream_read_data(instream, &data,
+					 &iov.iov_len, 0)) != -1) {
+		if (iov.iov_len == 0)
 			return sent;
 
-		iov.iov_base = i_stream_get_data(instream, &iov.iov_len);
+		iov.iov_base = data;
 		ret = o_stream_sendv(&outstream->ostream, &iov, 1);
 		if (ret <= 0)
 			return ret < 0 && sent == 0 ? -1 : (ssize_t)sent;