]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] remove "none" from log messages when parsing global config
authorEvan Hunt <each@isc.org>
Sun, 31 Jan 2016 18:17:13 +0000 (10:17 -0800)
committerEvan Hunt <each@isc.org>
Sun, 31 Jan 2016 18:17:13 +0000 (10:17 -0800)
4309. [cleanup] Remove the spurious "none" filename from log messages
when processing built-in configuration. [RT #41594]

CHANGES
lib/isccfg/include/isccfg/grammar.h
lib/isccfg/parser.c

diff --git a/CHANGES b/CHANGES
index dbb7c7928010b3902dc71260452232719ababfeb..019d5479f705dda2fcc8e255d7d54d29c1eb85de 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4309.  [cleanup]       Remove the spurious "none" filename from log messages
+                       when processing built-in configuration. [RT #41594]
+
 4308.  [func]          Added operating system details to "named -V"
                        output. [RT #41452]
 
index f20d91a7c9c9cea814dfde9f8bd27647077a0bc2..34afc11a615e55e28a3c1708ae51eb9ec5d1d1ba 100644 (file)
@@ -167,6 +167,7 @@ struct cfg_obj {
        isc_refcount_t  references;     /*%< reference counter */
        const char *    file;
        unsigned int    line;
+       cfg_parser_t *  pctx;
 };
 
 
index b9621ef43a4ffd794078a58096c6998538d940c2..c81120f2019bbba28144cab30029375193819518 100644 (file)
@@ -2715,13 +2715,15 @@ cfg_obj_log(const cfg_obj_t *obj, isc_log_t *lctx, int level,
                return;
 
        va_start(ap, fmt);
-
        vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
-       isc_log_write(lctx, CAT, MOD, level,
-                     "%s:%u: %s",
-                     obj->file == NULL ? "<unknown file>" : obj->file,
-                     obj->line, msgbuf);
        va_end(ap);
+
+       if (have_current_file(obj->pctx)) {
+               isc_log_write(lctx, CAT, MOD, level,
+                             "%s:%u: %s", obj->file, obj->line, msgbuf);
+       } else {
+               isc_log_write(lctx, CAT, MOD, level, "%s", msgbuf);
+       }
 }
 
 const char *
@@ -2742,15 +2744,19 @@ cfg_create_obj(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
        obj = isc_mem_get(pctx->mctx, sizeof(cfg_obj_t));
        if (obj == NULL)
                return (ISC_R_NOMEMORY);
+
        obj->type = type;
        obj->file = current_file(pctx);
        obj->line = pctx->line;
+       obj->pctx = pctx;
+
        result = isc_refcount_init(&obj->references, 1);
        if (result != ISC_R_SUCCESS) {
                isc_mem_put(pctx->mctx, obj, sizeof(cfg_obj_t));
                return (result);
        }
        *ret = obj;
+
        return (ISC_R_SUCCESS);
 }