summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/file.c b/file.c
index 4ef8d3258c..449d888814 100644
--- a/file.c
+++ b/file.c
@@ -97,10 +97,10 @@ file_s_open(argc, argv, klass)
file = file_open(RSTRING(fname)->ptr, mode);
RBASIC(file)->klass = klass;
+ obj_call_init(file);
if (iterator_p()) {
- rb_ensure(rb_yield, file, io_close, file);
+ return rb_ensure(rb_yield, file, io_close, file);
}
- obj_call_init(file);
return file;
}