From 399f0b278e1c02e25ef78e776b198b7300ee6ee0 Mon Sep 17 00:00:00 2001 From: Vftdan Date: Mon, 19 Aug 2024 21:13:38 +0200 Subject: [PATCH] Report config syntax errors --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index a6d5383..cc14911 100644 --- a/main.c +++ b/main.c @@ -99,7 +99,10 @@ main(int argc, char ** argv) config_t config_tree; FullConfig loaded_config; config_init(&config_tree); - config_read_file(&config_tree, config_filename); + if (config_read_file(&config_tree, config_filename) != CONFIG_TRUE) { + fprintf(stderr, "Config syntax error: %s:%d: %s\n", config_error_file(&config_tree), config_error_line(&config_tree), config_error_text(&config_tree)); + exit(1); + } config_set_auto_convert(&config_tree, CONFIG_TRUE); if (!load_config(config_root_setting(&config_tree), &loaded_config)) { perror("Failed to load config");