]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/rules: fix error logging with absolute path to ruledb
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 22 Jun 2026 13:16:45 +0000 (15:16 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 6 Aug 2026 09:17:13 +0000 (11:17 +0200)
Otherwise it was logging about /some/workdir//var/lib/knot-resolver/

(cherry picked from commit 823aa7f7376c016faa9d9095e8a98954e15a32ca)

lib/rules/api.c

index 7a57aad9d7f5997a66b645550b63a328bf479a4a..3b87c9eeb6d3d78f2c7c553b2f7d0603f01a2a4d 100644 (file)
@@ -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;
 }