check if parsing of ipsec update was successful

This commit is contained in:
Andreas Steffen
2008-07-02 05:51:49 +00:00
parent 4ddd73351c
commit 1dec30625e
2 changed files with 7 additions and 3 deletions
+2 -1
View File
@@ -931,8 +931,9 @@ confread_load(const char *file)
/* load IPSec configuration file */ /* load IPSec configuration file */
cfgp = parser_load_conf(file); cfgp = parser_load_conf(file);
if (!cfgp) if (!cfgp)
{
return NULL; return NULL;
}
cfg = (starter_config_t *)alloc_thing(starter_config_t, "starter_config_t"); cfg = (starter_config_t *)alloc_thing(starter_config_t, "starter_config_t");
/* set default values */ /* set default values */
+5 -2
View File
@@ -452,7 +452,7 @@ int main (int argc, char **argv)
); );
new_cfg = confread_load(CONFIG_FILE); new_cfg = confread_load(CONFIG_FILE);
if (new_cfg->err + new_cfg->non_fatal_err == 0) if (new_cfg && (new_cfg->err + new_cfg->non_fatal_err == 0))
{ {
/* Switch to new config. New conn will be loaded below */ /* Switch to new config. New conn will be loaded below */
if (!starter_cmp_defaultroute(&new_cfg->defaultroute if (!starter_cmp_defaultroute(&new_cfg->defaultroute
@@ -546,7 +546,10 @@ int main (int argc, char **argv)
else else
{ {
plog("can't reload config file due to errors -- keeping old one"); plog("can't reload config file due to errors -- keeping old one");
confread_free(new_cfg); if (new_cfg)
{
confread_free(new_cfg);
}
} }
_action_ &= ~FLAG_ACTION_UPDATE; _action_ &= ~FLAG_ACTION_UPDATE;
last_reload = time(NULL); last_reload = time(NULL);