Don't return ugly error strings from OpenSSL

This commit is contained in:
Přemysl Eric Janouch 2015-07-15 00:35:35 +02:00
parent fcc3f9e19c
commit 02708608a9

View File

@ -2575,7 +2575,7 @@ xssl_get_error (SSL *ssl, int result, const char **error_info)
return error; return error;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
if ((error = ERR_get_error ())) if ((error = ERR_get_error ()))
*error_info = ERR_error_string (error, NULL); *error_info = ERR_reason_error_string (error);
else if (result == 0) else if (result == 0)
// An EOF that's not according to the protocol is still an EOF // An EOF that's not according to the protocol is still an EOF
return SSL_ERROR_ZERO_RETURN; return SSL_ERROR_ZERO_RETURN;
@ -2588,9 +2588,9 @@ xssl_get_error (SSL *ssl, int result, const char **error_info)
return SSL_ERROR_SSL; return SSL_ERROR_SSL;
default: default:
if ((error = ERR_get_error ())) if ((error = ERR_get_error ()))
*error_info = ERR_error_string (error, NULL); *error_info = ERR_reason_error_string (error);
else else
*error_info = "Unknown error"; *error_info = "unknown error";
return SSL_ERROR_SSL; return SSL_ERROR_SSL;
} }
} }