diff options
author | dougb <dougb@FreeBSD.org> | 2012-05-28 09:49:28 +0000 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2012-05-28 09:49:28 +0000 |
commit | 28648ebad5d82231050fad98edaea0139041dab5 (patch) | |
tree | d1c6443b417cd46cab150c0b06bb9d7ed9e4670b /lib/isccfg | |
parent | 99137cc0869ff3151f403a8255695487f6441a0d (diff) | |
download | FreeBSD-src-28648ebad5d82231050fad98edaea0139041dab5.zip FreeBSD-src-28648ebad5d82231050fad98edaea0139041dab5.tar.gz |
Vendor import of BIND 9.8.3
Diffstat (limited to 'lib/isccfg')
-rw-r--r-- | lib/isccfg/api | 2 | ||||
-rw-r--r-- | lib/isccfg/parser.c | 24 |
2 files changed, 21 insertions, 5 deletions
diff --git a/lib/isccfg/api b/lib/isccfg/api index 2b2a12d..9f3d38c 100644 --- a/lib/isccfg/api +++ b/lib/isccfg/api @@ -4,5 +4,5 @@ # 9.8: 80-89 # 9.9: 90-109 LIBINTERFACE = 82 -LIBREVISION = 1 +LIBREVISION = 2 LIBAGE = 0 diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 1d1f08e..ef20184 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -2232,16 +2232,30 @@ cfg_parser_warning(cfg_parser_t *pctx, unsigned int flags, const char *fmt, ...) #define MAX_LOG_TOKEN 30 /* How much of a token to quote in log messages. */ +static isc_boolean_t +have_current_file(cfg_parser_t *pctx) { + cfg_listelt_t *elt; + if (pctx->open_files == NULL) + return (ISC_FALSE); + + elt = ISC_LIST_TAIL(pctx->open_files->value.list); + if (elt == NULL) + return (ISC_FALSE); + + return (ISC_TRUE); +} + static char * current_file(cfg_parser_t *pctx) { static char none[] = "none"; cfg_listelt_t *elt; cfg_obj_t *fileobj; - if (pctx->open_files == NULL) + if (!have_current_file(pctx)) return (none); + elt = ISC_LIST_TAIL(pctx->open_files->value.list); - if (elt == NULL) + if (elt == NULL) /* shouldn't be possible, but... */ return (none); fileobj = elt->obj; @@ -2264,8 +2278,10 @@ parser_complain(cfg_parser_t *pctx, isc_boolean_t is_warning, if (is_warning) level = ISC_LOG_WARNING; - snprintf(where, sizeof(where), "%s:%u: ", - current_file(pctx), pctx->line); + where[0] = '\0'; + if (have_current_file(pctx)) + snprintf(where, sizeof(where), "%s:%u: ", + current_file(pctx), pctx->line); len = vsnprintf(message, sizeof(message), format, args); if (len >= sizeof(message)) |