1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

io.c: discard buffer always

* io.c (copy_stream_fallback_body): discard buffer always before
  exit or exception.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-02-27 03:54:54 +00:00
parent 19711c7803
commit b84e28d133

2
io.c
View file

@ -10462,11 +10462,11 @@ copy_stream_fallback_body(VALUE arg)
ssize_t ss;
rb_str_resize(buf, buflen);
ss = maygvl_copy_stream_read(1, stp, RSTRING_PTR(buf), l, off);
rb_str_resize(buf, ss > 0 ? ss : 0);
if (ss == -1)
return Qnil;
if (ss == 0)
rb_eof_error();
rb_str_resize(buf, ss);
if (off != (off_t)-1)
off += ss;
}