diff options
author | Omar Polo <op@omarpolo.com> | 2023-06-09 17:24:37 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2023-06-09 17:24:37 +0000 |
commit | 68368f4c29e208c67724b04fd0142e233a247a2a (patch) | |
tree | 2a4c6596dbd28f3f726d467e4222f677dae5cf18 /gmid.c | |
parent | af1dab18702cf135aa80bf15065f73050c915347 (diff) |
parse_conf: don't die on error, return -1
this avoids having the daemon dieing on SIGHUP with a bad config
file.
Diffstat (limited to 'gmid.c')
-rw-r--r-- | gmid.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -230,7 +230,8 @@ main(int argc, char **argv) conf = config_new(); - parse_conf(conf, config_path); + if (parse_conf(conf, config_path) == -1) + errx(1, "failed to load configuration file"); if (*conf->chroot != '\0' && *conf->user == '\0') fatalx("can't chroot without a user to switch to after."); @@ -345,7 +346,11 @@ main_reload(struct conf *conf) log_debug("%s: config file %s", __func__, config_path); config_purge(conf); - parse_conf(conf, config_path); /* XXX should handle error here */ + + if (parse_conf(conf, config_path) == -1) { + log_warnx("failed to parse the config"); + return; + } main_configure(conf); } |