[monitoring-plugins] Clean up parse_ini error messages, add missing ...

Git Repository git at monitoring-plugins.org
Sat Jan 25 10:40:07 CET 2014


 Module: monitoring-plugins
 Branch: master
 Commit: 25a289f307270bb8f814a2df923aeab50acd50c6
 Author: Thomas Guyot-Sionnest <dermoth at aei.ca>
   Date: Sat Jan 25 04:13:32 2014 -0500
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=25a289f

Clean up parse_ini error messages, add missing newlines

---

 lib/parse_ini.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index 05d6a02..76953e9 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -101,7 +101,7 @@ np_arg_list* np_get_defaults(const char *locator, const char *default_section){
 		} else {
 			inifile=fopen(i.file, "r");
 		}
-		if(inifile==NULL) die(STATE_UNKNOWN, _("Can't read config file"));
+		if(inifile==NULL) die(STATE_UNKNOWN, "%s\n", _("Can't read config file"));
 		if(read_defaults(inifile, i.stanza, &defaults)==FALSE)
 			die(STATE_UNKNOWN, _("Invalid section '%s' in config file '%s'\n"), i.stanza, i.file);
 
@@ -163,7 +163,7 @@ static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts){
 					 * we're dealing with a config error
 					 */
 					case NOSTANZA:
-						die(STATE_UNKNOWN, _("Config file error"));
+						die(STATE_UNKNOWN, "%s\n", _("Config file error"));
 						break;
 					/* we're in a stanza, but for a different plugin */
 					case WRONGSTANZA:
@@ -173,7 +173,7 @@ static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts){
 					case RIGHTSTANZA:
 						ungetc(c, f);
 						if(add_option(f, opts)){
-							die(STATE_UNKNOWN, _("Config file error"));
+							die(STATE_UNKNOWN, "%s\n", _("Config file error"));
 						}
 						status=TRUE;
 						break;
@@ -229,7 +229,7 @@ static int add_option(FILE *f, np_arg_list **optlst){
 	if(optend==NULL) optend=eqptr;
 	--optend;
 	/* ^[[:space:]]*=foo is a syntax error */
-	if(optptr==eqptr) die(STATE_UNKNOWN, _("Config file error\n"));
+	if(optptr==eqptr) die(STATE_UNKNOWN, "%s\n", _("Config file error"));
 	/* continue from '=' to start of value or EOL */
 	for(valptr=eqptr+1; valptr<lineend && isspace(*valptr); valptr++);
 	/* continue to the end of value */
@@ -256,7 +256,7 @@ static int add_option(FILE *f, np_arg_list **optlst){
 		cfg_len+=1;
 	}
 	/* A line with no equal sign isn't valid */
-	if(equals==0) die(STATE_UNKNOWN, _("Config file error\n"));
+	if(equals==0) die(STATE_UNKNOWN, "%s\n", _("Config file error"));
 
 	/* okay, now we have all the info we need, so we create a new np_arg_list
 	 * element and set the argument...



More information about the Commits mailing list