summaryrefslogtreecommitdiffstats
path: root/apps/asn1pars.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-05-28 13:52:55 -0400
committerRich Salz <rsalz@openssl.org>2015-05-28 17:28:33 -0400
commitcc01d21756cc9c79231ef21039782c5fe42008a2 (patch)
treecb92584cc79d9994f9859b15c04a645d0b020389 /apps/asn1pars.c
parentf097f81c891bb1f479426d8ac9c9541390334983 (diff)
RT3876: Only load config when needed
Create app_load_config(), a routine to load config file. Remove the "always load config" from the main app. Change the places that used to load config to call the new common routine. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/asn1pars.c')
-rw-r--r--apps/asn1pars.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/apps/asn1pars.c b/apps/asn1pars.c
index 42338da1d4..d188f4a5c1 100644
--- a/apps/asn1pars.c
+++ b/apps/asn1pars.c
@@ -334,14 +334,12 @@ static int do_generate(char *genstr, char *genconf, BUF_MEM *buf)
{
CONF *cnf = NULL;
int len;
- long errline = 0;
unsigned char *p;
ASN1_TYPE *atyp = NULL;
if (genconf) {
- cnf = NCONF_new(NULL);
- if (!NCONF_load(cnf, genconf, &errline))
- goto conferr;
+ if ((cnf = app_load_config(genconf)) == NULL)
+ goto err;
if (!genstr)
genstr = NCONF_get_string(cnf, "default", "asn1");
if (!genstr) {
@@ -372,18 +370,8 @@ static int do_generate(char *genstr, char *genconf, BUF_MEM *buf)
ASN1_TYPE_free(atyp);
return len;
- conferr:
-
- if (errline > 0)
- BIO_printf(bio_err, "Error on line %ld of config file '%s'\n",
- errline, genconf);
- else
- BIO_printf(bio_err, "Error loading config file '%s'\n", genconf);
-
err:
NCONF_free(cnf);
ASN1_TYPE_free(atyp);
-
return -1;
-
}