"open" error message should include pathname. fixes #77.

This commit is contained in:
Tomoyuki Sahara
2017-05-19 17:14:43 +09:00
parent 728d313b2c
commit 6836f424c5
+5 -1
View File
@@ -556,6 +556,7 @@ mrb_io_s_sysclose(mrb_state *mrb, mrb_value klass)
int
mrb_cloexec_open(mrb_state *mrb, const char *pathname, mrb_int flags, mrb_int mode)
{
mrb_value emsg;
int fd, retry = FALSE;
#ifdef O_CLOEXEC
@@ -576,7 +577,10 @@ reopen:
goto reopen;
}
}
mrb_sys_fail(mrb, "open");
emsg = mrb_format(mrb, "open %S", mrb_str_new_cstr(mrb, pathname));
mrb_str_modify(mrb, mrb_str_ptr(emsg));
mrb_sys_fail(mrb, RSTRING_PTR(emsg));
}
if (fd <= 2) {