From f34f20ebc5ef12d37315d8228ba21b6cd4bcb9a1 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 14 Apr 2003 09:04:43 +0000 Subject: * rubyio.h (struct OpenFile): add error raise flag to finalizer. * io.c (Init_IO): define $/, $-0, and $\ as string-only variables. * string.c (rb_str_split_m): does not generate empty string if there's no match in the receiver. * io.c (fptr_finalize): should raise error on EBADF for readable IOs as well. * file.c (rb_stat): use rb_check_convert_type() to retrieve IO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index bd793c5a1b..93ed79b224 100644 --- a/file.c +++ b/file.c @@ -346,11 +346,14 @@ rb_stat(file, st) VALUE file; struct stat *st; { - if (TYPE(file) == T_FILE) { + VALUE tmp; + + tmp = rb_check_convert_type(file, T_FILE, "IO", "to_io"); + if (!NIL_P(tmp)) { OpenFile *fptr; rb_secure(2); - GetOpenFile(file, fptr); + GetOpenFile(tmp, fptr); return fstat(fileno(fptr->f), st); } SafeStringValue(file); -- cgit v1.2.3