[dovecot-cvs] dovecot/src/lib ostream-file.c,1.29,1.30
cras at dovecot.org
cras at dovecot.org
Mon Aug 23 07:48:01 EEST 2004
Update of /home/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv2011
Modified Files:
ostream-file.c
Log Message:
o_stream_sendv() returned wrong value if sending more than UIO_MAXIOV
iovecs.
Index: ostream-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- ostream-file.c 22 Aug 2004 04:51:50 -0000 1.29
+++ ostream-file.c 23 Aug 2004 04:47:58 -0000 1.30
@@ -133,12 +133,13 @@
const struct const_iovec *iov, int iov_size)
{
ssize_t ret;
- size_t size;
+ size_t size, sent;
int i;
if (iov_size == 1)
ret = write(fstream->fd, iov->iov_base, iov->iov_len);
else {
+ sent = 0;
while (iov_size > UIO_MAXIOV) {
size = 0;
for (i = 0; i < UIO_MAXIOV; i++)
@@ -149,6 +150,7 @@
if (ret != (ssize_t)size)
break;
+ sent += ret;
iov += UIO_MAXIOV;
iov_size -= UIO_MAXIOV;
}
@@ -156,6 +158,8 @@
if (iov_size <= UIO_MAXIOV) {
ret = writev(fstream->fd, (const struct iovec *)iov,
iov_size);
+ if (ret > 0)
+ ret += sent;
}
}
More information about the dovecot-cvs
mailing list