summaryrefslogtreecommitdiffstats
path: root/lib/parse_ini.c
diff options
context:
space:
mode:
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 d5661c9..96551cf 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -34,7 +34,6 @@
34#include <sys/stat.h> 34#include <sys/stat.h>
35#include <unistd.h> 35#include <unistd.h>
36 36
37/* TODO: die like N::P if section is not found */
38/* TODO: die like N::P if config file is not found */ 37/* TODO: die like N::P if config file is not found */
39 38
40/* np_ini_info contains the result of parsing a "locator" in the format 39/* 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){
104 inifile=fopen(i.file, "r"); 103 inifile=fopen(i.file, "r");
105 } 104 }
106 if(inifile==NULL) die(STATE_UNKNOWN, _("Can't read config file")); 105 if(inifile==NULL) die(STATE_UNKNOWN, _("Can't read config file"));
107 if(read_defaults(inifile, i.stanza, &defaults)==FALSE && strcmp(i.stanza, default_section) && inifile!=stdin) { 106 if(read_defaults(inifile, i.stanza, &defaults)==FALSE)
108 /* We got nothing, try the default section */ 107 die(STATE_UNKNOWN, _("Invalid section '%s' in config file '%s'\n"), i.stanza, i.file);
109 rewind(inifile);
110 read_defaults(inifile, default_section, &defaults);
111 }
112 108
113 free(i.file); 109 free(i.file);
114 if(inifile!=stdin) fclose(inifile); 110 if(inifile!=stdin) fclose(inifile);