summaryrefslogtreecommitdiff
path: root/src/starter/starter.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/starter/starter.c')
-rw-r--r--src/starter/starter.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/starter/starter.c b/src/starter/starter.c
index 0bf1d7a71..3cf7017fd 100644
--- a/src/starter/starter.c
+++ b/src/starter/starter.c
@@ -237,9 +237,13 @@ int main (int argc, char **argv)
}
cfg = confread_load(CONFIG_FILE);
- if (!cfg)
+ if (cfg == NULL || cfg->err > 0)
{
- plog("unable to start strongSwan -- errors in config");
+ plog("unable to start strongSwan -- fatal errors in config");
+ if (cfg)
+ {
+ confread_free(cfg);
+ }
exit(1);
}
@@ -276,6 +280,7 @@ int main (int argc, char **argv)
dup2(fnull, STDERR_FILENO);
close(fnull);
}
+ setsid();
}
break;
case -1:
@@ -372,7 +377,7 @@ int main (int argc, char **argv)
);
new_cfg = confread_load(CONFIG_FILE);
- if (new_cfg)
+ if (new_cfg->err + new_cfg->non_fatal_err == 0)
{
/* Switch to new config. New conn will be loaded below */
if (!starter_cmp_defaultroute(&new_cfg->defaultroute
@@ -465,7 +470,8 @@ int main (int argc, char **argv)
}
else
{
- plog("can't reload config file: %s -- keeping old one");
+ plog("can't reload config file due to errors -- keeping old one");
+ confread_free(new_cfg);
}
_action_ &= ~FLAG_ACTION_UPDATE;
last_reload = time(NULL);