diff options
author | nobu <nobu@ruby-lang.org> | 2014-03-05 02:58:59 +0000 |
---|---|---|
committer | nobu <nobu@ruby-lang.org> | 2014-03-05 02:58:59 +0000 |
commit | 26321031194bd8314b65ce779a0ebb999d064d32 (patch) | |
tree | 62a84755fb17c2e1e9c70ca4de77f4e226166892 /ext/openssl/ossl.c | |
parent | c485b0fa484e6bdf11a21d37d8866f73e43b35d5 (diff) | |
download | ruby-openssl-history-26321031194bd8314b65ce779a0ebb999d064d32.tar.gz |
ossl.c: NULL check
* ext/openssl/ossl.c (ossl_make_error): check NULL for unknown
error reasons with old OpenSSL, and insert a colon iff formatted
message is not empty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl.c')
-rw-r--r-- | ext/openssl/ossl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 614d2fa..7f9105c 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -312,10 +312,11 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args) else msg = ERR_reason_error_string(e); if (NIL_P(str)) { - str = rb_str_new_cstr(msg); + if (msg) str = rb_str_new_cstr(msg); } else { - rb_str_cat2(rb_str_cat2(str, ": "), msg); + if (RSTRING_LEN(str)) rb_str_cat2(str, ": "); + rb_str_cat2(str, msg ? msg : "(null)"); } } if (dOSSL == Qtrue){ /* show all errors on the stack */ |