Commit a239c03c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Allow vcl_init{} to return(fail) in which case vcl.load or vcl.inline

fails too.
parent c7611af5
......@@ -220,13 +220,19 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
FREE_OBJ(vcl);
return (1);
}
REPLACE(vcl->name, name);
VCLI_Out(cli, "Loaded \"%s\" as \"%s\"", fn , name);
VTAILQ_INSERT_TAIL(&vcl_head, vcl, list);
ctx.method = VCL_MET_INIT;
ctx.handling = &hand;
(void)vcl->conf->init_func(&ctx);
if (hand == VCL_RET_FAIL) {
VCLI_Out(cli, "VCL \"%s\" vcl_init{} failed", name);
(void)dlclose(vcl->dlh);
FREE_OBJ(vcl);
return (1);
}
assert(hand == VCL_RET_OK);
REPLACE(vcl->name, name);
VCLI_Out(cli, "Loaded \"%s\" as \"%s\"", fn , name);
VTAILQ_INSERT_TAIL(&vcl_head, vcl, list);
Lck_Lock(&vcl_mtx);
if (vcl_active == NULL)
vcl_active = vcl;
......
......@@ -538,7 +538,7 @@ mcf_config_inline(struct cli *cli, const char * const *av, void *priv)
VCLI_SetResult(cli, CLIS_PARAM);
return;
}
VCLI_Out(cli, "VCL compiled.");
VCLI_Out(cli, "VCL compiled.\n");
if (child_pid >= 0 &&
mgt_cli_askchild(&status, &p, "vcl.load %s %s\n", av[2], vf)) {
VCLI_SetResult(cli, status);
......
......@@ -140,7 +140,7 @@ returns =(
('init',
"",
('ok',)
('ok', 'fail')
),
('fini',
"",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment