summaryrefslogtreecommitdiff
path: root/ext/stringio/stringio.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-24 05:23:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-24 05:23:32 +0000
commit6fe8d987ce2296174dcd3e4f3c382f8114728210 (patch)
tree2ec4e1c67c58d3f4851b3bb15902034afcbfb8e5 /ext/stringio/stringio.c
parent73d77c8f572b760b4c868579188fc39f360151cb (diff)
* ext/stringio/stringio.c (strio_read): clear the buffer argument
when returning nil. [ruby-dev:22363] * test/ruby/ut_eof.rb (TestEOF::test_eof_0, TestEOF::test_eof_1): add buffer argument tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio/stringio.c')
-rw-r--r--ext/stringio/stringio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 1bab5b4d1f..8d3275b2b8 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -851,9 +851,11 @@ strio_read(argc, argv, self)
}
if (len > 0 && ptr->pos >= RSTRING(ptr->string)->len) {
ptr->flags |= STRIO_EOF;
+ if (!NIL_P(str)) rb_str_resize(str, 0);
return Qnil;
}
else if (ptr->flags & STRIO_EOF) {
+ if (!NIL_P(str)) rb_str_resize(str, 0);
return Qnil;
}
break;