aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_pkcs7.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-09-04 16:17:23 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-10-27 16:16:00 +0900
commitd5a62c2d9e92e980d98a75c92d3e102cd0711ed1 (patch)
tree7ef6ed3b5bfb157166ddabd44800e032adad3426 /ext/openssl/ossl_pkcs7.c
parent47c0ef65cd553864ff236b5e4cd37e4ac8188690 (diff)
downloadruby-openssl-d5a62c2d9e92e980d98a75c92d3e102cd0711ed1.tar.gz
Avoid using ERR_get_error()
Use ERR_peek_error() which does not remove the fetched error from the queue instead, then clear the queue explicitly with the dedicated function ossl_clear_error(). OpenSSL may put multiple error items to the queue in one function call.
Diffstat (limited to 'ext/openssl/ossl_pkcs7.c')
-rw-r--r--ext/openssl/ossl_pkcs7.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index fd58b48b..4040355f 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -795,7 +795,7 @@ ossl_pkcs7_verify(int argc, VALUE *argv, VALUE self)
BIO_free(in);
sk_X509_pop_free(x509s, X509_free);
if (ok < 0) ossl_raise(ePKCS7Error, "PKCS7_verify");
- msg = ERR_reason_error_string(ERR_get_error());
+ msg = ERR_reason_error_string(ERR_peek_error());
ossl_pkcs7_set_err_string(self, msg ? rb_str_new2(msg) : Qnil);
ossl_clear_error();
data = ossl_membio2str(out);