mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
* fhandler_base.cc (fhandler_base::readv): Free buf, not a pointer into the
middle of buf.
This commit is contained in:
parent
b397593c94
commit
8eb445cfd3
@ -1,3 +1,8 @@
|
||||
2005-11-08 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* fhandler_base.cc (fhandler_base::readv): Free buf, not a pointer into
|
||||
the middle of buf.
|
||||
|
||||
2005-11-08 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* memmem.cc: New file.
|
||||
|
@ -969,7 +969,7 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
char *buf = (char *) malloc (tot);
|
||||
char *buf = (char *) malloc (len);
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
@ -982,11 +982,12 @@ fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
|
||||
|
||||
const struct iovec *iovptr = iov;
|
||||
|
||||
char *p = buf;
|
||||
while (nbytes > 0)
|
||||
{
|
||||
const int frag = min (nbytes, (ssize_t) iovptr->iov_len);
|
||||
memcpy (iovptr->iov_base, buf, frag);
|
||||
buf += frag;
|
||||
memcpy (iovptr->iov_base, p, frag);
|
||||
p += frag;
|
||||
iovptr += 1;
|
||||
nbytes -= frag;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user