lib/base: heim_config_parse_debug doesn't return com_err table errors

A non-zero return value from heim_config_parse_debug() means there
was an failure to open or parse the configuration data.  However, it
is not necessarily an error code.  Callers when setting an error
message must use an error code.

This change to heim_config_parse_file_multi() and
heim_config_parse_string_multi() set an error code of
HEIM_ERR_CONFIG_BADFORMAT when setting the error message.

Change-Id: I534b9af1c50e32d79799a936cb6252dab99c2a64
This commit is contained in:
Jeffrey Altman
2020-05-25 17:39:59 -04:00
committed by Nicolas Williams
parent 965121630c
commit 58db0edea0

View File

@@ -667,8 +667,11 @@ heim_config_parse_file_multi(heim_context context,
config_include_depth--;
fclose(f.f);
if (ret) {
heim_set_error_message(context, ret, "%s:%u: %s",
fname, lineno, str);
if (ret != HEIM_ERR_CONFIG_BADFORMAT) {
ret = HEIM_ERR_CONFIG_BADFORMAT;
heim_set_error_message(context, ret, "%s:%u: %s",
fname, lineno, str);
}
free(newfname);
return ret;
}
@@ -1462,8 +1465,11 @@ heim_config_parse_string_multi(heim_context context,
ret = heim_config_parse_debug(&f, res, &lineno, &str);
if (ret) {
heim_set_error_message(context, ret, "%s:%u: %s",
"<constant>", lineno, str);
if (ret != HEIM_ERR_CONFIG_BADFORMAT) {
ret = HEIM_ERR_CONFIG_BADFORMAT;
heim_set_error_message(context, ret, "%s:%u: %s",
"<constant>", lineno, str);
}
return ret;
}
return 0;