aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2023-06-09 17:24:37 +0000
committerOmar Polo <op@omarpolo.com>2023-06-09 17:24:37 +0000
commit68368f4c29e208c67724b04fd0142e233a247a2a (patch)
tree2a4c6596dbd28f3f726d467e4222f677dae5cf18 /gmid.c
parentaf1dab18702cf135aa80bf15065f73050c915347 (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.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gmid.c b/gmid.c
index 1a796d2..a9616eb 100644
--- a/gmid.c
+++ b/gmid.c
@@ -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);
}