1217. [func] Report locations of previous key definition when a

duplicate is detected.
This commit is contained in:
Mark Andrews 2002-03-04 05:27:31 +00:00
parent 89f7901415
commit 2211bec6a0
2 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,6 @@
1217. [func] Report locations of previous key definition when a
duplicate is detected.
1216. [bug] Multiple server clauses for the same server were not
reported. [RT #2514]

View file

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: check.c,v 1.27 2002/03/04 05:24:33 marka Exp $ */
/* $Id: check.c,v 1.28 2002/03/04 05:27:29 marka Exp $ */
#include <config.h>
@ -419,12 +419,24 @@ check_keylist(cfg_obj_t *keys, isc_symtab_t *symtab, isc_log_t *logctx) {
const char *keyname = cfg_obj_asstring(cfg_map_getname(key));
isc_symvalue_t symvalue;
symvalue.as_pointer = NULL;
symvalue.as_pointer = key;
tresult = isc_symtab_define(symtab, keyname, 1,
symvalue, isc_symexists_reject);
if (tresult == ISC_R_EXISTS) {
const char *file;
unsigned int line;
RUNTIME_CHECK(isc_symtab_lookup(symtab, keyname,
1, &symvalue) == ISC_R_SUCCESS);
file = cfg_obj_file(symvalue.as_pointer);
line = cfg_obj_line(symvalue.as_pointer);
if (file == NULL)
file = "<unknown file>";
cfg_obj_log(key, logctx, ISC_LOG_ERROR,
"key '%s': already exists ", keyname);
"key '%s': already exists "
"previous definition: %s:%u",
keyname, file, line);
result = tresult;
} else if (tresult != ISC_R_SUCCESS)
return (tresult);