mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 22:45:39 +00:00
3197. [bug] Don't try to log the filename and line number when
the config parser can't open a file. [RT #22263]
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
3197. [bug] Don't try to log the filename and line number when
|
||||||
|
the config parser can't open a file. [RT #22263]
|
||||||
|
|
||||||
3196. [bug] nsupdate: return nonzero exit code when target zone
|
3196. [bug] nsupdate: return nonzero exit code when target zone
|
||||||
doesn't exist. [RT #25783]
|
doesn't exist. [RT #25783]
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* PERFORMANCE OF THIS SOFTWARE.
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: parser.c,v 1.141 2011/03/11 06:11:27 marka Exp $ */
|
/* $Id: parser.c,v 1.142 2011/11/03 05:15:09 each Exp $ */
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
@@ -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. */
|
#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 *
|
static char *
|
||||||
current_file(cfg_parser_t *pctx) {
|
current_file(cfg_parser_t *pctx) {
|
||||||
static char none[] = "none";
|
static char none[] = "none";
|
||||||
cfg_listelt_t *elt;
|
cfg_listelt_t *elt;
|
||||||
cfg_obj_t *fileobj;
|
cfg_obj_t *fileobj;
|
||||||
|
|
||||||
if (pctx->open_files == NULL)
|
if (!have_current_file(pctx))
|
||||||
return (none);
|
return (none);
|
||||||
|
|
||||||
elt = ISC_LIST_TAIL(pctx->open_files->value.list);
|
elt = ISC_LIST_TAIL(pctx->open_files->value.list);
|
||||||
if (elt == NULL)
|
if (elt == NULL) /* shouldn't be possible, but... */
|
||||||
return (none);
|
return (none);
|
||||||
|
|
||||||
fileobj = elt->obj;
|
fileobj = elt->obj;
|
||||||
@@ -2264,8 +2278,10 @@ parser_complain(cfg_parser_t *pctx, isc_boolean_t is_warning,
|
|||||||
if (is_warning)
|
if (is_warning)
|
||||||
level = ISC_LOG_WARNING;
|
level = ISC_LOG_WARNING;
|
||||||
|
|
||||||
snprintf(where, sizeof(where), "%s:%u: ",
|
where[0] = '\0';
|
||||||
current_file(pctx), pctx->line);
|
if (have_current_file(pctx))
|
||||||
|
snprintf(where, sizeof(where), "%s:%u: ",
|
||||||
|
current_file(pctx), pctx->line);
|
||||||
|
|
||||||
len = vsnprintf(message, sizeof(message), format, args);
|
len = vsnprintf(message, sizeof(message), format, args);
|
||||||
if (len >= sizeof(message))
|
if (len >= sizeof(message))
|
||||||
|
Reference in New Issue
Block a user