Add the mask check for the loaded config

If some config is not loaded, we can't get the default value,
so we must ensure all the configs are loaded.

Change-Id: I198af4fac6f873d3e7785d2105d14898be084d48
Partial-Bug: #1835370
Signed-off-by: Tao Li <litao3721@126.com>
This commit is contained in:
Tao Li 2019-07-10 15:25:07 +08:00
parent 2cbb73f862
commit 73146540e2
1 changed files with 10 additions and 1 deletions

View File

@ -142,12 +142,21 @@ int daemon_configure ( void )
if (ini_parse(HOSTWD_CONFIG_FILE, hostw_process_config, config) < 0)
{
elog("Can't load '%s'\n", HOSTWD_CONFIG_FILE);
return (FAIL_INI_CONFIG);
return (FAIL_LOAD_INI);
}
if (ini_parse(PMOND_CONFIG_FILE, hostw_process_config, config) < 0)
{
elog("Can't load '%s'\n", PMOND_CONFIG_FILE);
return (FAIL_LOAD_INI);
}
/* Verify loaded config against an expected mask
* as an ini file fault detection method */
if ( config->mask != CONFIG_MASK )
{
elog ("Error: host watchdog configuration failed (%x)\n",
((-1 ^ config->mask) & CONFIG_MASK));
return (FAIL_INI_CONFIG);
}