diff options
| author | Federico Angelilli <code@fedang.net> | 2024-11-23 23:44:09 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-11-23 23:44:09 +0100 |
| commit | 9ff1b4a86bd44d4dfe984de41a85062c2b014655 (patch) | |
| tree | 679e02b6d7f87290c8c81d3709e698be9c0d09f2 /src/comet.c | |
| parent | 828c4af8886b970fba9edcbaa5c6a97916ad4aa8 (diff) | |
Separate config validation
Diffstat (limited to 'src/comet.c')
| -rw-r--r-- | src/comet.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/comet.c b/src/comet.c index 1b26bfb..be07826 100644 --- a/src/comet.c +++ b/src/comet.c @@ -66,7 +66,7 @@ int main(int argc, char **argv) any_log_level_t log_level = ANY_LOG_DEBUG; if (argc != 1 && !strcmp(argv[1], "--trace")) - log_level = ANY_LOG_TRACE; + log_level = ANY_LOG_TRACE; any_log_init(stdout, log_level); @@ -81,11 +81,17 @@ int main(int argc, char **argv) log_info("Reading config '%s'", config_path); int errors = config_read(&config, config_file); if (errors > 0) { - log_error("Config file contained %d errors", errors); + log_error("Config file contained %d syntax errors", errors); return EXIT_FAILURE; } } + int errors = config_validate(&config); + if (errors > 0) { + log_error("Config file contained %d errors", errors); + return EXIT_FAILURE; + } + signal(SIGINT, signal_quit); signal(SIGTERM, signal_quit); |
