From: Vladimír Čunát Date: Mon, 22 Jun 2026 13:16:45 +0000 (+0200) Subject: lib/rules: fix error logging with absolute path to ruledb X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad66f06fde077a7df6ccb627ecd3d138dbf96d73;p=thirdparty%2Fknot-resolver.git lib/rules: fix error logging with absolute path to ruledb Otherwise it was logging about /some/workdir//var/lib/knot-resolver/ (cherry picked from commit 823aa7f7376c016faa9d9095e8a98954e15a32ca) --- diff --git a/lib/rules/api.c b/lib/rules/api.c index 7a57aad9d..3b87c9eeb 100644 --- a/lib/rules/api.c +++ b/lib/rules/api.c @@ -198,7 +198,13 @@ int kr_rules_init(const char *path, size_t maxsize, bool overwrite) failure: free(the_rules); the_rules = NULL; - auto_free const char *path_abs = kr_absolutize_path(".", opts.path); + auto_free const char *str_to_free = NULL; + const char *path_abs; + if (opts.path[0] == '/') { + path_abs = opts.path; + } else { + path_abs = str_to_free = kr_absolutize_path(".", opts.path); + } kr_log_error(RULES, "failed while opening or initializing rule DB %s/\n", path_abs); return ret; }