From: Timo Sirainen Date: Thu, 3 Sep 2009 21:33:40 +0000 (-0400) Subject: config: When we detect a conflict, log where in config it came from. X-Git-Tag: 2.0.alpha1~190 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13be7f7215efe02d020e9d823772861df98b82bd;p=thirdparty%2Fdovecot%2Fcore.git config: When we detect a conflict, log where in config it came from. --HG-- branch : HEAD --- diff --git a/src/config/config-filter.c b/src/config/config-filter.c index 783ce9b068..3b6b4493d9 100644 --- a/src/config/config-filter.c +++ b/src/config/config-filter.c @@ -149,8 +149,9 @@ config_module_parser_apply_changes(struct config_module_parser *dest, if (settings_parser_apply_changes(dest[i].parser, src->parsers[i].parser, pool, error_r) < 0) { - *error_r = t_strdup_printf("Conflict in setting %s", - *error_r); + *error_r = t_strdup_printf("Conflict in setting %s " + "found from filter at %s", *error_r, + src->file_and_line); return -1; } } diff --git a/src/config/config-filter.h b/src/config/config-filter.h index b53ee77e17..7e2db415ec 100644 --- a/src/config/config-filter.h +++ b/src/config/config-filter.h @@ -11,6 +11,7 @@ struct config_filter { struct config_filter_parser { struct config_filter filter; + const char *file_and_line; /* NULL-terminated array of parsers */ struct config_module_parser *parsers; }; diff --git a/src/config/config-parser.c b/src/config/config-parser.c index 1e13d1d8f0..7c0e1316d6 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -166,6 +166,9 @@ config_add_new_parser(struct parser_context *ctx) parser = p_new(ctx->pool, struct config_filter_parser, 1); parser->filter = cur_section->filter; + parser->file_and_line = + p_strdup_printf(ctx->pool, "%s:%d", + ctx->cur_input->path, ctx->cur_input->linenum); parser->parsers = cur_section->prev == NULL ? ctx->root_parsers : config_module_parsers_init(ctx->pool); array_append(&ctx->all_parsers, &parser, 1); @@ -573,14 +576,14 @@ int config_parse_file(const char *path, bool expand_files, settings_parser_flags); } - p_array_init(&ctx.all_parsers, ctx.pool, 128); - ctx.cur_section = p_new(ctx.pool, struct config_section_stack, 1); - config_add_new_parser(&ctx); - memset(&root, 0, sizeof(root)); root.path = path; ctx.cur_input = &root; + p_array_init(&ctx.all_parsers, ctx.pool, 128); + ctx.cur_section = p_new(ctx.pool, struct config_section_stack, 1); + config_add_new_parser(&ctx); + str = t_str_new(256); full_line = t_str_new(512); errormsg = NULL;