aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-27 03:54:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-27 03:54:54 +0000
commitb84e28d13338c301c2264d9240ad467ad4f4216f (patch)
treed59f2fe407bad8c4f1b29e8c150b4e7b3df11df3 /io.c
parent19711c780300a3cb50a5ba269e4fc615362affcb (diff)
downloadruby-b84e28d13338c301c2264d9240ad467ad4f4216f.tar.gz
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
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io.c b/io.c
index 4610e8514a..015ff6cd5c 100644
--- a/io.c
+++ b/io.c
@@ -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;
}