summaryrefslogtreecommitdiff
path: root/apps/errstr.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-02-10 15:16:06 +0000
committerMatt Caswell <matt@openssl.org>2016-02-10 17:40:59 +0000
commit302f75887e52bbe0ab7a5806335a0a1264323b07 (patch)
tree704e3638b402a89e064f6cde7d893ad8b687581e /apps/errstr.c
parent0fc32b0718ec210e03b6d8623d4819ed04615a1b (diff)
downloadopenssl-new-302f75887e52bbe0ab7a5806335a0a1264323b07.tar.gz
Attempt to log an error if init failed
If init failed we'd like to set an error code to indicate that. But if init failed then when the error system tries to load its strings its going to fail again. We could get into an infinite loop. Therefore we just set a single error the first time around. After that no error is set. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/errstr.c')
-rw-r--r--apps/errstr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/errstr.c b/apps/errstr.c
index 960815da65..99bb9e9068 100644
--- a/apps/errstr.c
+++ b/apps/errstr.c
@@ -114,6 +114,11 @@ int errstr_main(int argc, char **argv)
if (!opt_ulong(*argv, &l))
ret++;
else {
+ /* We're not really an SSL application so this won't auto-init, but
+ * we're still interested in SSL error strings
+ */
+ OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS
+ | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
ERR_error_string_n(l, buf, sizeof buf);
BIO_printf(bio_out, "%s\n", buf);
}