зеркало из https://github.com/github/ruby.git
* error.c (syserr_initialize): use Errno constants as default
errno for subclasses. [ruby-dev:20241] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
b614db0432
Коммит
fdc0d3306c
|
@ -1,3 +1,8 @@
|
|||
Tue May 20 17:15:55 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* error.c (syserr_initialize): use Errno constants as default
|
||||
errno for subclasses. [ruby-dev:20241]
|
||||
|
||||
Tue May 20 15:26:25 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* st.h: define ST_DATA_T_DEFINED for portability.
|
||||
|
@ -20,7 +25,7 @@ Tue May 20 13:29:04 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
|||
Tue May 20 10:51:26 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* eval.c (rb_f_missing): create exception instance by ordinal
|
||||
method.
|
||||
method. [ruby-dev:20033]
|
||||
|
||||
* error.c (rb_name_error, rb_sys_fail): ditto.
|
||||
|
||||
|
|
8
error.c
8
error.c
|
@ -542,11 +542,17 @@ syserr_initialize(argc, argv, self)
|
|||
char *err;
|
||||
char *buf;
|
||||
VALUE error, mesg;
|
||||
VALUE klass = rb_obj_class(self);
|
||||
|
||||
if (rb_scan_args(argc, argv, "11", &mesg, &error) == 1 && FIXNUM_P(mesg)) {
|
||||
rb_scan_args(argc, argv, klass == rb_eSystemCallError ? "11" : "02",
|
||||
&mesg, &error);
|
||||
if (argc == 1 && FIXNUM_P(mesg)) {
|
||||
error = mesg;
|
||||
mesg = Qnil;
|
||||
}
|
||||
if (klass != rb_eSystemCallError && NIL_P(error)) {
|
||||
error = rb_const_get_at(klass, rb_intern("Errno"));
|
||||
}
|
||||
err = strerror(NUM2LONG(error));
|
||||
if (!err) err = "Unknown error";
|
||||
if (RTEST(mesg)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче