summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mrblib/file.rb13
-rw-r--r--src/io.c2
2 files changed, 2 insertions, 13 deletions
diff --git a/mrblib/file.rb b/mrblib/file.rb
index 5b6986985..243549cbb 100644
--- a/mrblib/file.rb
+++ b/mrblib/file.rb
@@ -14,20 +14,7 @@ class File < IO
super(fd_or_path, mode)
else
@path = fd_or_path
-
- perm = 0666 unless perm.is_a? Fixnum
fd = IO.sysopen(@path, mode, perm)
- if fd < 0 && Object.const_defined?(:Errno)
- begin
- Errno.handle @path
- rescue Errno::EMFILE
- GC.run(true)
- fd = IO.sysopen(@path, mode, perm)
- Errno.handle if fd < 0
- end
- elsif fd < 0
- raise NoFileError.new "no such file or directory"
- end
super(fd, mode)
end
end
diff --git a/src/io.c b/src/io.c
index 2438a1101..79f72d386 100644
--- a/src/io.c
+++ b/src/io.c
@@ -396,6 +396,8 @@ mrb_io_s_sysopen(mrb_state *mrb, mrb_value klass)
flags = mrb_io_modestr_to_flags(mrb, mrb_string_value_cstr(mrb, &mode));
fd = io_open(mrb, path, flags, perm);
+ if (fd == -1)
+ mrb_sys_fail(mrb, mrb_str_to_cstr(mrb, path));
return mrb_fixnum_value(fd);
}