diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-10 05:48:43 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-10 05:48:43 +0000 |
commit | 7194267b3bdf68ad75bd6bee8e7c6377f7b0ea2f (patch) | |
tree | 6dcd08ef584fc777cf34517136d5ce3948840e45 /error.c | |
parent | be72d9a5da9be284d2bdb8047e50f14e014b7835 (diff) |
2000-04-10
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -344,9 +344,9 @@ exc_inspect(exc) str = rb_str_new2("#<"); klass = rb_class_path(klass); - rb_str_concat(str, klass); + rb_str_append(str, klass); rb_str_cat(str, ": ", 2); - rb_str_concat(str, exc); + rb_str_append(str, exc); rb_str_cat(str, ">", 1); return str; @@ -631,8 +631,10 @@ rb_sys_fail(mesg) err = strerror(errno); if (mesg) { - buf = ALLOCA_N(char, strlen(err)+strlen(mesg)+4); - sprintf(buf, "%s - %s", err, mesg); + volatile VALUE tmp = rb_str_inspect(rb_str_new2(mesg)); + + buf = ALLOCA_N(char, strlen(err)+RSTRING(tmp)->len+4); + sprintf(buf, "%s - %s", err, RSTRING(tmp)->ptr); } else { buf = ALLOCA_N(char, strlen(err)+1); @@ -658,8 +660,8 @@ rb_sys_fail(mesg) else { ee = syserr_list[n]; } - ee = rb_exc_new2(ee, buf); #endif + ee = rb_exc_new2(ee, buf); rb_iv_set(ee, "errno", INT2FIX(n)); rb_exc_raise(ee); } |