From 71a7ef31d7d6343468db164804340920e17c2705 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 23 Oct 2017 05:09:35 +0000 Subject: io.c: fix buffered output * io.c (io_binwritev): append to buffered data, not overwriting. [Feature #9323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 703666ce62..bcd792861e 100644 --- a/io.c +++ b/io.c @@ -1518,8 +1518,8 @@ io_binwritev(struct iovec *iov, int iovcnt, rb_io_t *fptr) } if (fptr->wbuf.ptr && fptr->wbuf.len) { - if (fptr->wbuf.off + fptr->wbuf.len + total <= fptr->wbuf.capa) { - long offset = fptr->wbuf.off; + long offset = fptr->wbuf.off + fptr->wbuf.len; + if (offset + total <= fptr->wbuf.capa) { for (i = 1; i < iovcnt; i++) { memcpy(fptr->wbuf.ptr+offset, iov[i].iov_base, iov[i].iov_len); offset += iov[i].iov_len; -- cgit v1.2.3