[PATCH] base/nagios: Handle failures creating iobroker set

Robin Sonefors robin.sonefors at op5.com
Fri Dec 7 17:33:38 CET 2012


I suspect that some weird, random errors I've been seeing is actually
due to this call failing, but I can't tell if it does, because it's not
logged anywhere.

Because an error here is catastrophic, we really shouldn't ignore it.

Signed-off-by: Robin Sonefors <robin.sonefors at op5.com>
---
 base/nagios.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/base/nagios.c b/base/nagios.c
index 1836217..edbb58f 100644
--- a/base/nagios.c
+++ b/base/nagios.c
@@ -447,6 +447,11 @@ int main(int argc, char **argv, char **env) {
 
 		nagios_iobs = iobroker_create();
 
+		if (nagios_iobs == NULL) {
+			logit(NSLOG_RUNTIME_ERROR, TRUE, "Error: Couldn't create iobroker set: %s", strerror(errno));
+			exit(EXIT_FAILURE);
+		}
+
 		/* keep monitoring things until we get a shutdown command */
 		do {
 
-- 
1.7.11.7


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d




More information about the Developers mailing list