From 2a4640f6719b9688a68b796f697209b9b14cd179 Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Fri, 4 Apr 2008 10:11:22 +0000 Subject: 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 --- lib/parse_ini.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/parse_ini.c') 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 #include -/* 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); -- cgit v1.2.3-74-g34f1