parser-cfg: fix profile-desc

Printed "error parsing option profile-desc=..." when using that inside
of profile sections. This happened because we now check the presence of
an option before setting it, and profile-desc is not an option, but
special cased in the config parser.
This commit is contained in:
wm4 2013-02-18 17:01:25 +01:00
parent 187903ef31
commit 41763b6d56
1 changed files with 6 additions and 5 deletions

View File

@ -200,6 +200,11 @@ int m_config_parse_config_file(m_config_t *config, const char *conffile)
bstr bopt = bstr0(opt);
bstr bparam = bstr0(param);
if (profile && bstr_equals0(bopt, "profile-desc")) {
m_profile_set_desc(profile, param);
goto nextline;
}
tmp = m_config_option_requires_param(config, bopt);
if (tmp > 0 && !param_set)
tmp = M_OPT_MISSING_PARAM;
@ -212,11 +217,7 @@ int m_config_parse_config_file(m_config_t *config, const char *conffile)
}
if (profile) {
if (!strcmp(opt, "profile-desc"))
m_profile_set_desc(profile, param);
else
tmp = m_config_set_profile_option(config, profile,
bopt, bparam);
tmp = m_config_set_profile_option(config, profile, bopt, bparam);
} else {
tmp = m_config_set_option_ext(config, bopt, bparam,
M_SETOPT_FROM_CONFIG_FILE);