]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
knotc: add error log when zone-check fails due to a general error
authorDaniel Salzman <daniel.salzman@nic.cz>
Fri, 20 Jan 2023 12:13:46 +0000 (13:13 +0100)
committerDaniel Salzman <daniel.salzman@nic.cz>
Fri, 20 Jan 2023 12:15:07 +0000 (13:15 +0100)
fixes #829

src/knot/zone/zonefile.c
src/utils/knotc/commands.c

index 6113b8be5d594a383d1e9e40f07e3b0e41455074..e545497d975ab48d271552dd105c330eef122446 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2023 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -147,7 +147,7 @@ int zonefile_open(zloader_t *loader, const char *source,
 
        /* Check zone file. */
        if (access(source, F_OK | R_OK) != 0) {
-               return KNOT_EACCES;
+               return knot_map_errno();
        }
 
        /* Create context. */
index 3ba923c0ffe385c7b3c1c4943cf876f2a7f27bdf..abfb12be0acf2e7a56b5ab5f11007e1dc775b4ea 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2023 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -610,6 +610,12 @@ static int zone_check(const knot_dname_t *dname, void *data)
        conf_val_t mode = conf_zone_get(conf(), C_SEM_CHECKS, dname);
        int ret = zone_load_contents(conf(), dname, &contents, conf_opt(&mode), args->force);
        zone_contents_deep_free(contents);
+       if (ret != KNOT_EOK && ret != KNOT_ESEMCHECK) {
+               knot_dname_txt_storage_t name;
+               (void)knot_dname_to_str(name, dname, sizeof(name));
+               log_error("[%s] failed to check zone file (%s)", name, knot_strerror(ret));
+       }
+
        return ret;
 }