[Libsysio-commit] HEAD: libsysio/src ioctx.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2004-02-26 17:51:38
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12020/src Modified Files: ioctx.c Log Message: Fixed problems in _sysio_enumerate_iovec. It was not applying the limit correctly. It was not moving through the iovec list -- Just using the first entry count times. Index: ioctx.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctx.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- ioctx.c 24 Feb 2004 14:58:26 -0000 1.9 +++ ioctx.c 26 Feb 2004 17:35:43 -0000 1.10 @@ -450,8 +450,8 @@ _sysio_enumerate_iovec(const struct iove assert(limit >= 0); acc = 0; n = limit; - for (indx = 0; indx < count; indx++) { - if (limit < 0 || iov[indx].iov_len < n) { + for (indx = 0; n && indx < count; indx++) { + if (iov[indx].iov_len < n) { cc = (ssize_t )iov[indx].iov_len; if (cc < 0) return -EINVAL; @@ -474,8 +474,8 @@ _sysio_enumerate_iovec(const struct iove continue; } n = - limit < 0 || iov[indx].iov_len < (size_t )limit - ? iov[indx].iov_len + iov->iov_len < (size_t )limit + ? iov->iov_len : (size_t )limit; cc = (*f)(iov->iov_base, n, off, arg); if (cc <= 0) { @@ -483,12 +483,13 @@ _sysio_enumerate_iovec(const struct iove return acc; return cc; } + limit -= cc; remain = iov->iov_len - cc; cc += acc; if (acc && cc <= acc) abort(); /* bad driver! */ acc = cc; - if (remain) + if (remain || !limit) break; /* short/limited read */ iov++; } while (--count); |