mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Revert "error.c (mrb_sys_fail): errno argument removed from _sys_fail."
Intermediate function calls may update `errno`.
This reverts commit a099ca44f4.
This commit is contained in:
+5
-2
@@ -4,6 +4,7 @@
|
||||
** See Copyright Notice in mruby.h
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <mruby.h>
|
||||
#include <mruby/array.h>
|
||||
@@ -511,14 +512,16 @@ MRB_API mrb_noreturn void
|
||||
mrb_sys_fail(mrb_state *mrb, const char *mesg)
|
||||
{
|
||||
struct RClass *sce;
|
||||
mrb_int no;
|
||||
|
||||
no = (mrb_int)errno;
|
||||
if (mrb_class_defined_id(mrb, MRB_SYM(SystemCallError))) {
|
||||
sce = mrb_class_get_id(mrb, MRB_SYM(SystemCallError));
|
||||
if (mesg != NULL) {
|
||||
mrb_funcall_id(mrb, mrb_obj_value(sce), MRB_SYM(_sys_fail), 1, mrb_str_new_cstr(mrb, mesg));
|
||||
mrb_funcall_id(mrb, mrb_obj_value(sce), MRB_SYM(_sys_fail), 2, mrb_fixnum_value(no), mrb_str_new_cstr(mrb, mesg));
|
||||
}
|
||||
else {
|
||||
mrb_funcall_id(mrb, mrb_obj_value(sce), MRB_SYM(_sys_fail), 0);
|
||||
mrb_funcall_id(mrb, mrb_obj_value(sce), MRB_SYM(_sys_fail), 1, mrb_fixnum_value(no));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user