diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-11 14:29:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-11 14:29:46 +0000 |
commit | 376a974c78593dff0a0009ea5a9bb75b4e4d1bbb (patch) | |
tree | 8953fdd2e8c689022abb385c04a223b0f15f93ea /ext/stringio | |
parent | 85776d1299817798b62469f5b0e470843c6671f9 (diff) | |
download | ruby-376a974c78593dff0a0009ea5a9bb75b4e4d1bbb.tar.gz ruby-376a974c78593dff0a0009ea5a9bb75b4e4d1bbb.tar.xz ruby-376a974c78593dff0a0009ea5a9bb75b4e4d1bbb.zip |
* ext/stringio/stringio.c: keep holding string after closed.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio')
-rw-r--r-- | ext/stringio/stringio.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index db93c1ff8..55678f71d 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -382,10 +382,9 @@ strio_close(self) VALUE self; { struct StringIO *ptr = StringIO(self); - if (CLOSED(ptr)) { + if (CLOSED(ptr) || !(ptr->flags & FMODE_READWRITE)) { rb_raise(rb_eIOError, "closed stream"); } - ptr->string = Qnil; ptr->flags &= ~FMODE_READWRITE; return Qnil; } @@ -405,9 +404,7 @@ strio_close_read(self) if (!READABLE(ptr)) { rb_raise(rb_eIOError, "closing non-duplex IO for reading"); } - if (!((ptr->flags &= ~FMODE_READABLE) & FMODE_READWRITE)) { - ptr->string = Qnil; - } + ptr->flags &= ~FMODE_READABLE; return Qnil; } @@ -426,9 +423,7 @@ strio_close_write(self) if (!WRITABLE(ptr)) { rb_raise(rb_eIOError, "closing non-duplex IO for writing"); } - if (!((ptr->flags &= ~FMODE_WRITABLE) & FMODE_READWRITE)) { - ptr->string = Qnil; - } + ptr->flags &= ~FMODE_WRITABLE; return Qnil; } |