fhandler_base::readv

Lev Bishop lev.bishop@gmail.com
Wed May 24 02:11:00 GMT 2006


On 5/23/06, Christopher Faylor wrote:

> At this point in the code, tot is only used in the subsequent assert.
> If that is the rationale for this change wouldn't it make more sense to
> just check len in the assert?

It does make sense. Try this version.

2006-05-23  Lev Bishop  <lev.bishop+cygwin@gmail.com>

	* fhandler.cc (readv): Deal with tot not precalculated.
-------------- next part --------------
Index: fhandler.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler.cc,v
retrieving revision 1.251
diff -u -p -r1.251 fhandler.cc
--- fhandler.cc	22 Mar 2006 16:42:44 -0000	1.251
+++ fhandler.cc	24 May 2006 02:09:09 -0000
@@ -941,12 +941,11 @@ fhandler_base::write (const void *ptr, s
 
 ssize_t
 fhandler_base::readv (const struct iovec *const iov, const int iovcnt,
-		      ssize_t tot)
+		      ssize_t len)
 {
   assert (iov);
   assert (iovcnt >= 1);
 
-  size_t len = tot;
   if (iovcnt == 1)
     {
       len = iov->iov_len;
@@ -954,7 +953,7 @@ fhandler_base::readv (const struct iovec
       return len;
     }
 
-  if (tot == -1)		// i.e. if not pre-calculated by the caller.
+  if (len == -1)		// i.e. if not pre-calculated by the caller.
     {
       len = 0;
       const struct iovec *iovptr = iov + iovcnt;
@@ -966,7 +965,7 @@ fhandler_base::readv (const struct iovec
       while (iovptr != iov);
     }
 
-  assert (tot >= 0);
+  assert (len >= 0);
 
   if (!len)
     return 0;


More information about the Cygwin-patches mailing list