Commit 4709fae3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Don't panic if you try to relabel a VCL with the same label.

Fixes #2834
parent 5ecae908
......@@ -918,6 +918,13 @@ mcf_vcl_label(struct cli *cli, const char * const *av, void *priv)
VCLI_Out(cli, "%s is not a label", vpl->name);
return;
}
if (!VTAILQ_EMPTY(&vpl->dfrom) &&
VTAILQ_FIRST(&vpl->dfrom)->to == vpt) {
VCLI_SetResult(cli, CLIS_PARAM);
VCLI_Out(cli, "VCL '%s' already has label '%s'",
vpt->name, vpl->name);
return;
}
if (!VTAILQ_EMPTY(&vpt->dfrom) &&
!VTAILQ_EMPTY(&vpl->dto)) {
VCLI_SetResult(cli, CLIS_PARAM);
......
......@@ -13,6 +13,10 @@ varnish v1 -vcl+backend {
varnish v1 -clierr 106 "vcl.label vcl.A vcl1"
varnish v1 -cliok "vcl.label vclA vcl1"
varnish v1 -clierr 106 "vcl.label vclA vcl1"
varnish v1 -cliexpect {VCL 'vcl1' already has label 'vclA'} {
vcl.label vclA vcl1
}
varnish v1 -vcl+backend {
sub vcl_recv {
......
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