aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-04 09:13:57 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-04 09:13:57 +0000
commita4934a42cbb84b6679912226581c71b435671f55 (patch)
tree786c2a292058c36491b5bee098ebe5a0d0b4f00a /io.c
parent89d1dff3439044201c36f601e1b1fb3b906132db (diff)
downloadruby-a4934a42cbb84b6679912226581c71b435671f55.tar.gz
* io.c (read_all): fptr->f may be NULL, if IO is closed in the
signal handler. * io.c (io_read): ditto. * string.c (get_pat): remove 1.8.0 warning code. * string.c (rb_str_match): extend warning until 1.8.2. * string.c (rb_str_match2): ditto. * class.c (class_instance_method_list): remove 1.8.0 warnings. method_list now recurs. [ruby-dev:21816] * class.c (rb_obj_singleton_methods): ditto. * array.c (rb_ary_select): remove select with block. [ruby-dev:21824] * hash.c (rb_hash_select): ditto. * hash.c (env_select): ditto. * re.c (match_select): ditto. * struct.c (rb_struct_select): ditto. * process.c (check_uid_switch): remove duplicated error messages. * process.c (check_gid_switch): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/io.c b/io.c
index cac35eb7e6..28504c9197 100644
--- a/io.c
+++ b/io.c
@@ -790,6 +790,7 @@ read_all(fptr, siz, str)
n = rb_io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f);
if (pos > 0 && n == 0 && bytes == 0) {
rb_str_resize(str,0);
+ if (!fptr->f) return Qnil;
if (feof(fptr->f)) return Qnil;
if (!ferror(fptr->f)) return str;
rb_sys_fail(fptr->path);
@@ -843,6 +844,7 @@ io_read(argc, argv, io)
n = rb_io_fread(RSTRING(str)->ptr, len, fptr->f);
if (n == 0) {
rb_str_resize(str,0);
+ if (!fptr->f) return Qnil;
if (feof(fptr->f)) return Qnil;
if (len > 0) rb_sys_fail(fptr->path);
}