Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-08-30 19:47:10 +0400
committerChristopher Faylor <me@cgf.cx>2002-08-30 19:47:10 +0400
commitab7f9b938f8f0008fe71e8c790afb7f86a267e1c (patch)
treef8149696d46c25222099b0d51dab157e891e3037 /winsup/cygwin/fhandler_socket.cc
parent70c306d781b881d7142d2d99f481b0aace248270 (diff)
* miscfuncs.cc (check_iovec_for_read): Don't check buffer when zero length
iov_len. (check_iovec_for_write): Ditto. * fhandler.h (fhandler_base::readv): New method. (fhandler_base::writev): Ditto. * fhandler.cc (fhandler_base::readv): New method. (fhandler_base::writev): Ditto. * syscalls.cc (_read): Delegate to readv(2). (_write): Ditto, mutatis mutandi. (readv): Rewrite, based on the old _read code, to use the new fhandler_base::readv method. Improve access mode handling and ensure all calls reach the final strace statement. (writev): Ditto, mutatis mutandi. * include/sys/uio.h (struct iovec): Change field types to match SUSv3. * winsup.h (check_iovec_for_read): New function. (check_iovec_for_write): Ditto. * miscfuncs.cc (check_iovec_for_read): Ditto. (check_iovec_for_write): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r--winsup/cygwin/fhandler_socket.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 85b210752..94866e3fe 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -736,7 +736,9 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags)
p = buf;
while (nb > 0)
{
- ssize_t cnt = min(nb, iov->iov_len);
+ ssize_t cnt = iov->iov_len;
+ if (nb < cnt)
+ cnt = nb;
memcpy (iov->iov_base, p, cnt);
p += cnt;
nb -= cnt;