summaryrefslogtreecommitdiffstats
path: root/cfg.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-11-27 16:12:29 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-11-27 16:12:29 +0000
commit9b8998aeec9c4dff695ae4108965677d90d9c9c7 (patch)
tree358a98012cf609e45ff77aaecc8f01000aee0425 /cfg.c
parent4aa4e9fb267a2169c6446da5cc2edaafd56b0195 (diff)
Correctly aggregate together errors from nested config files (with
source-file). Fix by Thomas Adam, reported by Sam Livingstone-Gray
Diffstat (limited to 'cfg.c')
-rw-r--r--cfg.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/cfg.c b/cfg.c
index ae7d9a30..3da6ea4d 100644
--- a/cfg.c
+++ b/cfg.c
@@ -34,9 +34,10 @@
void printflike2 cfg_print(struct cmd_ctx *, const char *, ...);
void printflike2 cfg_error(struct cmd_ctx *, const char *, ...);
-char *cfg_cause;
-int cfg_finished;
-struct causelist cfg_causes = ARRAY_INITIALIZER;
+char *cfg_cause;
+int cfg_finished;
+int cfg_references;
+struct causelist cfg_causes;
/* ARGSUSED */
void printflike2
@@ -89,6 +90,8 @@ load_cfg(const char *path, struct cmd_ctx *ctxin, struct causelist *causes)
}
n = 0;
+ cfg_references++;
+
line = NULL;
retval = CMD_RETURN_NORMAL;
while ((buf = fgetln(f, &len))) {
@@ -171,6 +174,8 @@ load_cfg(const char *path, struct cmd_ctx *ctxin, struct causelist *causes)
}
fclose(f);
+ cfg_references--;
+
return (retval);
}