summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-24 08:11:01 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-24 08:11:01 +0000
commit6c024efb9064aafb69ea55a7df8c2005cce86081 (patch)
tree0889cd2656b987b879e0fd73d67de9ca7ea715da /io.c
parent4a0bb2dc4879f4b2f945af4b9e2ff847e0075ee6 (diff)
* io.c (rb_io_inspect): Cannot access fptr->fd if fptr is NULL.
This fixes a coredump caused by: ruby -e "class X < IO; def initialize; end; end; p X.new.inspect" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/io.c b/io.c
index 0a984a18db..19ea6132be 100644
--- a/io.c
+++ b/io.c
@@ -1387,8 +1387,9 @@ rb_io_inspect(VALUE obj)
const char *st = "";
fptr = RFILE(rb_io_taint_check(obj))->fptr;
+ if (!fptr) return rb_any_to_s(obj);
cname = rb_obj_classname(obj);
- if (!fptr || NIL_P(fptr->pathv)) {
+ if (NIL_P(fptr->pathv)) {
if (fptr->fd < 0) {
path = "";
st = "(closed)";