summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorTomoyuki Sahara <[email protected]>2013-11-16 05:12:22 +0900
committerTomoyuki Sahara <[email protected]>2013-11-16 05:14:07 +0900
commit1e8097a4b895e673846be848feffdd0556041a65 (patch)
treed905241b984874e7bfe05cd895755f7daf3423db /src
parent93edd26b3e0d3d96f4589a8c7a382d12b911b52a (diff)
downloadmruby-1e8097a4b895e673846be848feffdd0556041a65.tar.gz
mruby-1e8097a4b895e673846be848feffdd0556041a65.zip
IO.sysopen raises an exception when open(2) fails. closes #6.
Diffstat (limited to 'src')
-rw-r--r--src/io.c2
1 files changed, 2 insertions, 0 deletions
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);
}