diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 14:49:18 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-20 14:49:18 +0000 |
commit | 7503f1934669b2a50ffabe5394148fa8ddb7dfa2 (patch) | |
tree | a0ddd097b8d957a31a8d976220afa4cd84214f34 /error.c | |
parent | 8f6c729601bc7b0d8676a8b8799dcaeac5c9f463 (diff) | |
download | ruby-7503f1934669b2a50ffabe5394148fa8ddb7dfa2.tar.gz |
* error.c (exit_success_p): Check status code more carefully.
status code may have garbage in upper bit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -710,9 +710,15 @@ exit_status(VALUE exc) static VALUE exit_success_p(VALUE exc) { - VALUE status = rb_attr_get(exc, rb_intern("status")); - if (NIL_P(status)) return Qtrue; - if (status == INT2FIX(EXIT_SUCCESS)) return Qtrue; + VALUE status_val = rb_attr_get(exc, rb_intern("status")); + int status; + + if (NIL_P(status_val)) + return Qtrue; + status = NUM2INT(status_val); + if (WIFEXITED(status) && WEXITSTATUS(status) == EXIT_SUCCESS) + return Qtrue; + return Qfalse; } |