diff options
author | Richard Levitte <levitte@openssl.org> | 2020-11-04 16:14:00 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-11-13 09:35:31 +0100 |
commit | a150f8e1fcc38752fef4d7c75d765d8efc7d46d6 (patch) | |
tree | f7f62c9a5d8407d8b17820fbef67378aa7b9ddbb /crypto/conf/conf_ssl.c | |
parent | 9311d0c471ca2eaa259e8c1bbbeb7c46394c7ba2 (diff) |
CRYPTO: refactor ERR_raise()+ERR_add_error_data() to ERR_raise_data()
This is not done absolutely everywhere, as there are places where
the use of ERR_add_error_data() is quite complex, but at least the
simple cases are done.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13318)
Diffstat (limited to 'crypto/conf/conf_ssl.c')
-rw-r--r-- | crypto/conf/conf_ssl.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/crypto/conf/conf_ssl.c b/crypto/conf/conf_ssl.c index 6512dda132..a4b35bab99 100644 --- a/crypto/conf/conf_ssl.c +++ b/crypto/conf/conf_ssl.c @@ -68,11 +68,12 @@ static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf) ssl_conf_section = CONF_imodule_get_value(md); cmd_lists = NCONF_get_section(cnf, ssl_conf_section); if (sk_CONF_VALUE_num(cmd_lists) <= 0) { - if (cmd_lists == NULL) - ERR_raise(ERR_LIB_CONF, CONF_R_SSL_SECTION_NOT_FOUND); - else - ERR_raise(ERR_LIB_CONF, CONF_R_SSL_SECTION_EMPTY); - ERR_add_error_data(2, "section=", ssl_conf_section); + int rcode = + cmd_lists == NULL + ? CONF_R_SSL_SECTION_NOT_FOUND + : CONF_R_SSL_SECTION_EMPTY; + + ERR_raise_data(ERR_LIB_CONF, rcode, "section=%s", ssl_conf_section); goto err; } cnt = sk_CONF_VALUE_num(cmd_lists); @@ -87,13 +88,13 @@ static int ssl_module_init(CONF_IMODULE *md, const CONF *cnf) STACK_OF(CONF_VALUE) *cmds = NCONF_get_section(cnf, sect->value); if (sk_CONF_VALUE_num(cmds) <= 0) { - if (cmds == NULL) - ERR_raise(ERR_LIB_CONF, - CONF_R_SSL_COMMAND_SECTION_NOT_FOUND); - else - ERR_raise(ERR_LIB_CONF, - CONF_R_SSL_COMMAND_SECTION_EMPTY); - ERR_add_error_data(4, "name=", sect->name, ", value=", sect->value); + int rcode = + cmds == NULL + ? CONF_R_SSL_COMMAND_SECTION_NOT_FOUND + : CONF_R_SSL_COMMAND_SECTION_EMPTY; + + ERR_raise_data(ERR_LIB_CONF, rcode, + "name=%s, value=%s", sect->name, sect->value); goto err; } ssl_name->name = OPENSSL_strdup(sect->name); |