Diffstat (limited to 'parsing.c')
| -rw-r--r-- | parsing.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -64,21 +64,19 @@ int read_config_line(FILE *f, char *line, const char **value, int bufsize) int cgit_read_config(const char *filename, configfn fn) { - static int nesting; - int len; + int ret = 0, len; char line[256]; const char *value; - FILE *f; + FILE *f = fopen(filename, "r"); - /* cancel the reading of yet another configfile after 16 invocations */ - if (nesting++ > 16) - return -1; - if (!(f = fopen(filename, "r"))) + if (!f) return -1; + while((len = read_config_line(f, line, &value, sizeof(line))) > 0) (*fn)(line, value); + fclose(f); - return 0; + return ret; } char *convert_query_hexchar(char *txt) |