summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-30 14:50:41 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-30 14:50:41 +0000
commit0cc54369d76631b77cded2f5491cdaeb30d33ef0 (patch)
tree5f0a3260acec231cbc834c86aedad12d70a7d6ae /ext
parentfd2d57979face0e161b9a5aa3122abfe00a4819c (diff)
merge revision(s) r45271: [Backport #9592] [Backport #9670]
* 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/branches/ruby_2_0_0@45472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 1a6b71b477..ed6153d869 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -311,10 +311,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 */