Mercurial > dovecot > core-2.2
changeset 12383:e57054f88e66
config parser: Log an error about missing '}'.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 04 Nov 2010 15:47:37 +0000 |
parents | af252c044393 |
children | 71e13b4a44d4 |
files | src/config/config-parser-private.h src/config/config-parser.c |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/config/config-parser-private.h Thu Nov 04 14:11:15 2010 +0000 +++ b/src/config/config-parser-private.h Thu Nov 04 15:47:37 2010 +0000 @@ -23,6 +23,9 @@ /* root=NULL-terminated list of parsers */ struct config_module_parser *parsers; unsigned int pathlen; + + const char *open_path; + unsigned int open_linenum; }; struct input_stack {
--- a/src/config/config-parser.c Thu Nov 04 14:11:15 2010 +0000 +++ b/src/config/config-parser.c Thu Nov 04 15:47:37 2010 +0000 @@ -165,6 +165,9 @@ section->prev = ctx->cur_section; section->filter = ctx->cur_section->filter; section->parsers = ctx->cur_section->parsers; + + section->open_path = p_strdup(ctx->pool, ctx->cur_input->path); + section->open_linenum = ctx->cur_input->linenum; return section; } @@ -312,6 +315,14 @@ pool_t tmp_pool; int ret = 0; + if (ctx->cur_section->prev != NULL) { + *error_r = t_strdup_printf( + "Missing '}' (section started at %s:%u)", + ctx->cur_section->open_path, + ctx->cur_section->open_linenum); + return -1; + } + tmp_pool = pool_alloconly_create("config parsers check", 1024*32); parsers = array_get(&ctx->all_parsers, &count); i_assert(count > 0 && parsers[count-1] == NULL);