summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_socket.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-07-24 13:21:02 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-07-24 13:21:02 +0000
commitc999d29a7b7031fbc827dca740650745d6da0488 (patch)
tree209cea4e4003bed5a7d90d437df0b05e4cd3f3cc /winsup/cygwin/fhandler_socket.cc
parente4994e769ed5b4219ddc6e5144a92068f5996614 (diff)
downloadcygnal-c999d29a7b7031fbc827dca740650745d6da0488.tar.gz
cygnal-c999d29a7b7031fbc827dca740650745d6da0488.tar.bz2
cygnal-c999d29a7b7031fbc827dca740650745d6da0488.zip
* fhandler_socket.cc (fhandler_socket::send_internal): Fix value of
out_len when tweaking the last buffer so out_len is correct in a subsequent if expression.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r--winsup/cygwin/fhandler_socket.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index dbcd2619c..793578f39 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -1701,9 +1701,13 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags)
while (out_len < (unsigned) wmem ()
&& (in_off = 0, ++in_idx < wsamsg->dwBufferCount));
/* Tweak len of the last out_buf buffer so the entire number of bytes
- is less than wmem (). */
+ is (less than or) equal to wmem (). Fix out_len as well since it's
+ used in a subsequent test expression. */
if (out_len > (unsigned) wmem ())
- out_buf[out_idx - 1].len -= out_len - (unsigned) wmem ();
+ {
+ out_buf[out_idx - 1].len -= out_len - (unsigned) wmem ();
+ out_len = (unsigned) wmem ();
+ }
/* Add the bytes written from the current last buffer to in_off,
so in_off points to the next byte to be written from that buffer,
or beyond which lets the outper loop skip to the next buffer. */