From: Daniel Salzman Date: Fri, 20 Jan 2023 12:13:46 +0000 (+0100) Subject: knotc: add error log when zone-check fails due to a general error X-Git-Tag: v3.4.dev~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1771fb23622cde7844edbd392efff459f8a69165;p=thirdparty%2Fknot-dns.git knotc: add error log when zone-check fails due to a general error fixes #829 --- diff --git a/src/knot/zone/zonefile.c b/src/knot/zone/zonefile.c index 6113b8be5d..e545497d97 100644 --- a/src/knot/zone/zonefile.c +++ b/src/knot/zone/zonefile.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 CZ.NIC, z.s.p.o. +/* Copyright (C) 2023 CZ.NIC, z.s.p.o. 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. */ diff --git a/src/utils/knotc/commands.c b/src/utils/knotc/commands.c index 3ba923c0ff..abfb12be0a 100644 --- a/src/utils/knotc/commands.c +++ b/src/utils/knotc/commands.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 CZ.NIC, z.s.p.o. +/* Copyright (C) 2023 CZ.NIC, z.s.p.o. 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; }