[icinga-checkins] icinga.org: icinga-core/feature/exclude-with-regexp-3720: core: abort early if main config file cannot be read

git at icinga.org git at icinga.org
Sat Jul 20 13:54:44 CEST 2013


Module: icinga-core
Branch: feature/exclude-with-regexp-3720
Commit: 52b87dadb8a2eac0f988a5eaccd22a53523243af
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=52b87dadb8a2eac0f988a5eaccd22a53523243af

Author: Michael Friedrich <Michael.Friedrich at netways.de>
Date:   Sat Jun 29 19:15:28 2013 +0200

core: abort early if main config file cannot be read

---

 base/icinga.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/base/icinga.c b/base/icinga.c
index 1c00a38..6f584c7 100644
--- a/base/icinga.c
+++ b/base/icinga.c
@@ -659,7 +659,11 @@ int main(int argc, char **argv, char **env) {
 			nagios_pid = (int)getpid();
 
 			/* read in the configuration files (main and resource config files) */
-			result = read_main_config_file(config_file);
+			if (read_main_config_file(config_file) == ERROR) {
+				logit(NSLOG_PROCESS_INFO | NSLOG_RUNTIME_ERROR | NSLOG_CONFIG_ERROR, TRUE, "Failed to read main config file.  Aborting.");
+				cleanup();
+				exit(EXIT_FAILURE);
+			}
 
 			/* we need to read the modules in the first place as object configuration before neb modules are initialized/loaded */
 			result = read_object_config_data(config_file, READ_MODULES, FALSE, FALSE);





More information about the icinga-checkins mailing list