From 1592bf7349d65260b3c90cfe3ead6f7caf92b81f Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 11 Sep 2001 04:56:06 +0000 Subject: [PATCH] 989. [bug] Report filename if $INCLUDE fails for file related errors. [RT #1736] --- CHANGES | 2 ++ lib/dns/master.c | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 429ae53168..28a96fc983 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ + 989. [bug] Report filename if $INCLUDE fails for file related + errors. [RT #1736] 988. [bug] 'additional-from-auth no;' did not work reliably in the case of queries answered from the cache. diff --git a/lib/dns/master.c b/lib/dns/master.c index cf55a00fdb..e3c5316784 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: master.c,v 1.124 2001/09/05 16:55:05 gson Exp $ */ +/* $Id: master.c,v 1.125 2001/09/11 04:56:06 marka Exp $ */ #include @@ -242,11 +242,22 @@ loadctx_destroy(dns_loadctx_t *lctx); #define MANYERRS(lctx, result) \ ((result != ISC_R_SUCCESS) && \ ((lctx)->options & DNS_MASTER_MANYERRORS) != 0) + #define SETRESULT(lctx, r) \ do { \ if ((lctx)->result == ISC_R_SUCCESS) \ (lctx)->result = r; \ } while (0) + +#define LOGITFILE(result, filename) \ + if (result == ISC_R_INVALIDFILE || result == ISC_R_FILENOTFOUND || \ + result == ISC_R_IOERROR || result == ISC_R_TOOMANYOPENFILES || \ + result == ISC_R_NOPERM) \ + (*callbacks->error)(callbacks, "%s: %s:%lu: %s: %s", \ + "dns_master_load", source, line, \ + filename, dns_result_totext(result)); \ + else LOGIT(result) + #define LOGIT(result) \ if (result == ISC_R_NOMEMORY) \ (*callbacks->error)(callbacks, "dns_master_load: %s", \ @@ -946,10 +957,12 @@ load(dns_loadctx_t *lctx) { ictx->origin, lctx); if (MANYERRS(lctx, result)) { SETRESULT(lctx, result); - LOGIT(result); + LOGITFILE(result, include_file); continue; - } else if (result != ISC_R_SUCCESS) - goto log_and_cleanup; + } else if (result != ISC_R_SUCCESS) { + LOGITFILE(result, include_file); + goto insist_and_cleanup; + } ictx = lctx->inc; line = isc_lex_getsourceline(lctx->lex); source = @@ -1125,8 +1138,10 @@ load(dns_loadctx_t *lctx) { SETRESULT(lctx, result); LOGIT(result); continue; - } else if (result != ISC_R_SUCCESS) - goto log_and_cleanup; + } else if (result != ISC_R_SUCCESS) { + LOGITFILE(result, include_file); + goto insist_and_cleanup; + } ictx = lctx->inc; line = isc_lex_getsourceline(lctx->lex); source = isc_lex_getsourcename(lctx->lex);