From: Ian Jackson Date: Sun, 24 May 2020 19:46:00 +0000 (+0100) Subject: config parsing: When closure is of wrong type, report how X-Git-Tag: v0.6.1~5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=fe5b6fbe125b6cf5d2c55625a79f733830e654ed;p=secnet.git config parsing: When closure is of wrong type, report how Signed-off-by: Ian Jackson --- diff --git a/log.c b/log.c index dd3e477..aca1b9b 100644 --- a/log.c +++ b/log.c @@ -165,8 +165,13 @@ void cfgfatal_maybefile(FILE *maybe_f, struct cloc loc, cstring_t facility, void cfgfatal_cl_type(struct cloc loc, const char *facility, closure_t *cl, uint32_t exp_type, const char *name) { + char expbuf[10], gotbuf[10]; assert(cl->type != exp_type); - cfgfatal(loc,facility,"\"%s\" is the wrong type of closure\n",name); + const char *exp = closure_type_name(exp_type, expbuf); + const char *got = closure_type_name(cl->type, gotbuf); + cfgfatal(loc,facility, + "\"%s\" is the wrong type of closure (expected %s, got %s)\n", + name, exp, got); } void cfgfatal(struct cloc loc, cstring_t facility, const char *message, ...)