aboutsummaryrefslogtreecommitdiffstats
path: root/lib/isccfg
diff options
context:
space:
mode:
authorDoug Barton <dougb@FreeBSD.org>2012-05-28 10:21:54 +0000
committerDoug Barton <dougb@FreeBSD.org>2012-05-28 10:21:54 +0000
commit31ffd11de096ff42940ae937e8e5a955664514c9 (patch)
tree6dc3dc4c57d86d545b84f6bf88014bfc1dcf80fa /lib/isccfg
parent65880d08f9383b1b2f7d971891cc32f9ba70e051 (diff)
downloadsrc-31ffd11de096ff42940ae937e8e5a955664514c9.tar.gz
src-31ffd11de096ff42940ae937e8e5a955664514c9.zip
Vendor import of BIND 9.6-ESV-R7vendor/bind9/9.6-ESV-R7
Notes
Notes: svn path=/vendor/bind9/dist-9.6/; revision=236174 svn path=/vendor/bind9/9.6-ESV-R7/; revision=236175; tag=vendor/bind9/9.6-ESV-R7
Diffstat (limited to 'lib/isccfg')
-rw-r--r--lib/isccfg/api2
-rw-r--r--lib/isccfg/parser.c24
2 files changed, 21 insertions, 5 deletions
diff --git a/lib/isccfg/api b/lib/isccfg/api
index ae9fbaedc545..d15c78ebe60d 100644
--- a/lib/isccfg/api
+++ b/lib/isccfg/api
@@ -4,5 +4,5 @@
# 9.8: 80-89
# 9.9: 90-109
LIBINTERFACE = 50
-LIBREVISION = 4
+LIBREVISION = 6
LIBAGE = 0
diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c
index 8bb563a1b742..3d02379447e0 100644
--- a/lib/isccfg/parser.c
+++ b/lib/isccfg/parser.c
@@ -2203,16 +2203,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;
@@ -2235,8 +2249,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))