aboutsummaryrefslogtreecommitdiff
path: root/lib/parse_ini.c
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2008-04-04 10:11:22 +0000
committerGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2008-04-04 10:11:22 +0000
commit2a4640f6719b9688a68b796f697209b9b14cd179 (patch)
treec90a814eba255846196eede28260c3b64e391e8b /lib/parse_ini.c
parent815fbd802f1aeee32d3d1b3751bf294e46a4c090 (diff)
downloadmonitoring-plugins-2a4640f6719b9688a68b796f697209b9b14cd179.tar.gz
make parse_ini die like in N::P if section isn't found
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1976 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/parse_ini.c')
-rw-r--r--lib/parse_ini.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index d5661c9e..96551cfe 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -34,7 +34,6 @@
#include <sys/stat.h>
#include <unistd.h>
-/* TODO: die like N::P if section is not found */
/* TODO: die like N::P if config file is not found */
/* np_ini_info contains the result of parsing a "locator" in the format
@@ -104,11 +103,8 @@ np_arg_list* np_get_defaults(const char *locator, const char *default_section){
inifile=fopen(i.file, "r");
}
if(inifile==NULL) die(STATE_UNKNOWN, _("Can't read config file"));
- if(read_defaults(inifile, i.stanza, &defaults)==FALSE && strcmp(i.stanza, default_section) && inifile!=stdin) {
- /* We got nothing, try the default section */
- rewind(inifile);
- read_defaults(inifile, default_section, &defaults);
- }
+ if(read_defaults(inifile, i.stanza, &defaults)==FALSE)
+ die(STATE_UNKNOWN, _("Invalid section '%s' in config file '%s'\n"), i.stanza, i.file);
free(i.file);
if(inifile!=stdin) fclose(inifile);