[monitoring-plugins] lib/parse_ini.c: Print proper read error message

Holger Weiss git at monitoring-plugins.org
Wed Jun 18 23:50:08 CEST 2014


 Module: monitoring-plugins
 Branch: master
 Commit: dc0f25cf76397b13f39a1d0fc50e9174114478ca
 Author: Holger Weiss <holger at zedat.fu-berlin.de>
   Date: Wed Jun 18 23:42:57 2014 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=dc0f25c

lib/parse_ini.c: Print proper read error message

Print a useful error message if opening the configuration file fails.

---

 lib/parse_ini.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index 86b94e7..25abc89 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -129,7 +129,8 @@ np_get_defaults(const char *locator, const char *default_section)
 	inifile = strcmp(i.file, "-") == 0 ? stdin : fopen(i.file, "r");
 
 	if (inifile == NULL)
-		die(STATE_UNKNOWN, "%s\n", _("Can't read config file"));
+		die(STATE_UNKNOWN, _("Can't read config file: %s\n"),
+		    strerror(errno));
 	if (read_defaults(inifile, i.stanza, &defaults) == FALSE)
 		die(STATE_UNKNOWN,
 		    _("Invalid section '%s' in config file '%s'\n"), i.stanza,



More information about the Commits mailing list