]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: When we detect a conflict, log where in config it came from.
authorTimo Sirainen <tss@iki.fi>
Thu, 3 Sep 2009 21:33:40 +0000 (17:33 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 3 Sep 2009 21:33:40 +0000 (17:33 -0400)
--HG--
branch : HEAD

src/config/config-filter.c
src/config/config-filter.h
src/config/config-parser.c

index 783ce9b06809d7e6e5dc49d2f886e0ecba8debc7..3b6b4493d98edac1e5e11885828f3f2d145f2131 100644 (file)
@@ -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;
                }
        }
index b53ee77e179502b357d511d9da683f946f7e07bc..7e2db415ecb426a1e4b046851c5b2d54f1aecc83 100644 (file)
@@ -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;
 };
index 1e13d1d8f06c287e63e7b3e455f8e00b3599df18..7c0e1316d6b9f1f3616b1bdf7c802f502192696b 100644 (file)
@@ -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;