ruby-changes:33192
From: nobu <ko1@a...>
Date: Wed, 5 Mar 2014 11:59:04 +0900 (JST)
Subject: [ruby-changes:33192] nobu:r45271 (trunk): ossl.c: NULL check
nobu 2014-03-05 11:58:59 +0900 (Wed, 05 Mar 2014) New Revision: 45271 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45271 Log: 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. Modified files: trunk/ChangeLog trunk/ext/openssl/ossl.c Index: ChangeLog =================================================================== --- ChangeLog (revision 45270) +++ ChangeLog (revision 45271) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Mar 5 11:58:30 2014 Nobuyoshi Nakada <nobu@r...> + + * 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. + Wed Mar 5 00:42:00 2014 Kazuki Tsujimoto <kazuki@c...> * ext/pathname/lib/pathname.rb (Pathname#find): add "ignore_error" Index: ext/openssl/ossl.c =================================================================== --- ext/openssl/ossl.c (revision 45270) +++ ext/openssl/ossl.c (revision 45271) @@ -312,10 +312,11 @@ ossl_make_error(VALUE exc, const char *f https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl.c#L312 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 */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/