From 9a43f0859d6f75bad979f116b48723a50453ad09 Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Wed, 8 Mar 2023 23:27:12 +0800 Subject: [PATCH] dns_conf: restore default config file path variable --- src/lib/conf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/conf.c b/src/lib/conf.c index 7669156..b64303a 100644 --- a/src/lib/conf.c +++ b/src/lib/conf.c @@ -321,6 +321,7 @@ static int load_conf_file(const char *file, struct config_item *items, conf_erro int line_no = 0; int line_len = 0; int read_len = 0; + const char *last_file = NULL; if (handler == NULL) { handler = load_conf_printf; @@ -374,6 +375,7 @@ static int load_conf_file(const char *file, struct config_item *items, conf_erro conf_getopt_reset(); /* call item function */ + last_file = current_conf_file; current_conf_file = file; call_ret = items[i].item_func(items[i].item, items[i].data, argc, argv); ret = handler(file, line_no, call_ret); @@ -383,6 +385,9 @@ static int load_conf_file(const char *file, struct config_item *items, conf_erro } conf_getopt_reset(); + if (last_file) { + current_conf_file = last_file; + } break; }