diff --git a/bin/tests/system/addzone/tests.sh b/bin/tests/system/addzone/tests.sh index 66c76bca18..ed897b9ba7 100755 --- a/bin/tests/system/addzone/tests.sh +++ b/bin/tests/system/addzone/tests.sh @@ -69,19 +69,19 @@ if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) nextpart ns2/named.run >/dev/null -echo_i "checking addzone errors are logged correctly" +echo_i "checking addzone errors are logged correctly ($n)" ret=0 $RNDCCMD 10.53.0.2 addzone bad.example '{ type mister; };' 2>&1 | grep 'unexpected token' >/dev/null 2>&1 || ret=1 -wait_for_log_peek 20 "addzone: 'mister' unexpected" ns2/named.run || ret=1 +wait_for_log_peek 20 "addzone:1: 'mister' unexpected" ns2/named.run || ret=1 n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) nextpart ns2/named.run >/dev/null -echo_i "checking modzone errors are logged correctly" +echo_i "checking modzone errors are logged correctly ($n)" ret=0 $RNDCCMD 10.53.0.2 modzone added.example '{ type mister; };' 2>&1 | grep 'unexpected token' >/dev/null 2>&1 || ret=1 -wait_for_log_peek 20 "modzone: 'mister' unexpected" ns2/named.run || ret=1 +wait_for_log_peek 20 "modzone:1: 'mister' unexpected" ns2/named.run || ret=1 n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 9582da2e0e..f0af06a8bb 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -3648,8 +3648,10 @@ parser_complain(cfg_parser_t *pctx, bool is_warning, unsigned int flags, if (file != NULL) { snprintf(where, sizeof(where), "%s:%u: ", cfg_obj_asstring(file), pctx->line); - } else if (pctx->buf_name != NULL) { - snprintf(where, sizeof(where), "%s: ", pctx->buf_name); + } else { + snprintf(where, sizeof(where), "%s:%u: ", + pctx->buf_name == NULL ? "none" : pctx->buf_name, + pctx->line); } len = vsnprintf(message, sizeof(message), format, args); @@ -3717,7 +3719,7 @@ cfg_obj_log(const cfg_obj_t *obj, int level, const char *fmt, ...) { isc_log_write(CAT, MOD, level, "%s:%u: %s", cfg_obj_asstring(obj->file), obj->line, msgbuf); } else { - isc_log_write(CAT, MOD, level, "%s", msgbuf); + isc_log_write(CAT, MOD, level, "%u: %s", obj->line, msgbuf); } }