aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-11 14:29:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-11 14:29:46 +0000
commitc06b78ca928f410d97b38a498b197471cd73f27b (patch)
tree8953fdd2e8c689022abb385c04a223b0f15f93ea
parentcc88d93a0ef39c3a8a89d2b2cde147f236be360c (diff)
downloadruby-c06b78ca928f410d97b38a498b197471cd73f27b.tar.gz
* ext/stringio/stringio.c: keep holding string after closed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--ext/stringio/stringio.c11
2 files changed, 9 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index cc10312bd9..c7e270be8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Aug 11 23:29:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c: keep holding string after closed.
+
Thu Aug 11 13:01:48 2005 Kouhei Sutou <kou@cozmixng.org>
* lib/rss: fixed sort bug. [ruby-list:41018]
@@ -46,9 +50,9 @@ Wed Aug 10 10:38:50 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
Wed Aug 10 10:29:40 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: fix bug on handling __ruby2val_optkeys().
+ * ext/tk/lib/tk.rb: fix bug on handling __ruby2val_optkeys().
- * ext/tk/lib/tk/itemconfig.rb: fix bug on handling
+ * ext/tk/lib/tk/itemconfig.rb: fix bug on handling
__item_ruby2val_optkeys().
* ext/tk/lib/tk/canvas.rb: didn't check __item_ruby2val_optkeys().
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index db93c1ff89..55678f71d8 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;
}