Commit 5972f082 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Reallow '-' in VCL names by popular demand.

Pass childs status on failure

Make atexit more robust
parent 478c664f
...@@ -103,7 +103,10 @@ mcf_bad_vclname(struct cli *cli, const char *name) ...@@ -103,7 +103,10 @@ mcf_bad_vclname(struct cli *cli, const char *name)
if (!vct_isalpha(*p)) if (!vct_isalpha(*p))
bad = *p; bad = *p;
for (p++; bad == 0 && *p != '\0'; p++) for (p++; bad == 0 && *p != '\0'; p++)
if (!vct_isalpha(*p) && !vct_isdigit(*p) && *p != '_') if (!vct_isalpha(*p) &&
!vct_isdigit(*p) &&
*p != '_' &&
*p != '-')
bad = *p; bad = *p;
if (bad) { if (bad) {
VCLI_SetResult(cli, CLIS_PARAM); VCLI_SetResult(cli, CLIS_PARAM);
...@@ -213,6 +216,8 @@ mgt_vcl_del(struct vclprog *vp) ...@@ -213,6 +216,8 @@ mgt_vcl_del(struct vclprog *vp)
char *p; char *p;
CHECK_OBJ_NOTNULL(vp, VCLPROG_MAGIC); CHECK_OBJ_NOTNULL(vp, VCLPROG_MAGIC);
while (!VTAILQ_EMPTY(&vp->dto))
mgt_vcl_dep_del(VTAILQ_FIRST(&vp->dto));
while (!VTAILQ_EMPTY(&vp->dfrom)) while (!VTAILQ_EMPTY(&vp->dfrom))
mgt_vcl_dep_del(VTAILQ_FIRST(&vp->dfrom)); mgt_vcl_dep_del(VTAILQ_FIRST(&vp->dfrom));
...@@ -352,7 +357,7 @@ mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc, ...@@ -352,7 +357,7 @@ mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc,
vp->name, vp->fname, vp->warm, vp->state)) { vp->name, vp->fname, vp->warm, vp->state)) {
mgt_vcl_del(vp); mgt_vcl_del(vp);
VCLI_Out(cli, "%s", p); VCLI_Out(cli, "%s", p);
VCLI_SetResult(cli, CLIS_PARAM); VCLI_SetResult(cli, status);
} }
free(p); free(p);
} }
...@@ -748,6 +753,7 @@ mgt_vcl_atexit(void) ...@@ -748,6 +753,7 @@ mgt_vcl_atexit(void)
if (getpid() != mgt_pid) if (getpid() != mgt_pid)
return; return;
active_vcl = NULL;
do { do {
vp = VTAILQ_FIRST(&vclhead); vp = VTAILQ_FIRST(&vclhead);
if (vp != NULL) if (vp != NULL)
......
...@@ -73,16 +73,16 @@ varnish v1 -clierr 106 "vcl.discard foo" ...@@ -73,16 +73,16 @@ varnish v1 -clierr 106 "vcl.discard foo"
varnish v1 -stop varnish v1 -stop
varnish v1 -cliok "vcl.list" varnish v1 -cliok "vcl.list"
varnish v1 -clierr 106 "vcl.label foo vcl0" varnish v1 -clierr 106 "vcl.label fo- vcl0"
varnish v1 -cliok "vcl.label foo vcl1" varnish v1 -cliok "vcl.label fo- vcl1"
varnish v1 -clierr 300 "vcl.label bar foo" varnish v1 -clierr 300 "vcl.label bar fo-"
varnish v1 -clierr 200 "vcl.state vcl1 warm" varnish v1 -clierr 200 "vcl.state vcl1 warm"
varnish v1 -clierr 200 "vcl.state vcl1 auto" varnish v1 -clierr 200 "vcl.state vcl1 auto"
varnish v1 -clierr 300 "vcl.state vcl1 cold" varnish v1 -clierr 300 "vcl.state vcl1 cold"
varnish v1 -clierr 300 "vcl.discard vcl1" varnish v1 -clierr 300 "vcl.discard vcl1"
varnish v1 -cliok "vcl.list" varnish v1 -cliok "vcl.list"
varnish v1 -cliok "vcl.use foo" varnish v1 -cliok "vcl.use fo-"
varnish v1 -clierr 300 "vcl.discard foo" varnish v1 -clierr 300 "vcl.discard fo-"
varnish v1 -cliok "vcl.list" varnish v1 -cliok "vcl.list"
server s1 -start server s1 -start
...@@ -91,8 +91,8 @@ varnish v1 -start ...@@ -91,8 +91,8 @@ varnish v1 -start
client c1 -run client c1 -run
varnish v1 -stop varnish v1 -stop
varnish v1 -cliok "vcl.use vcl1" varnish v1 -cliok "vcl.use vcl1"
varnish v1 -cliok "vcl.discard foo" varnish v1 -cliok "vcl.discard fo-"
varnish v1 -clierr 106 "vcl.discard foo" varnish v1 -clierr 106 "vcl.discard fo-"
varnish v1 -start varnish v1 -start
varnish v1 -cliok "vcl.label snarf vcl1" varnish v1 -cliok "vcl.label snarf vcl1"
......
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