[4.0] b8a4bb6 Fix vcl.show -v handling with no VCL
Lasse Karstensen
lkarsten at varnish-software.com
Thu Jan 15 16:35:43 CET 2015
commit b8a4bb64d8806e18e4aea01e7069c08448159ecc
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Mon Jan 12 04:48:12 2015 +0000
Fix vcl.show -v handling with no VCL
While here display the right VCL name if -v is used and the VCL is
not found.
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 2f7c1b9..7a6ac7d 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -381,18 +381,23 @@ ccf_config_show(struct cli *cli, const char * const *av, void *priv)
int i;
(void)priv;
- if (!strcmp(av[2], "-v")) {
- verbose = 1;
- vcl = vcl_find(av[3]);
- } else if (av[3] != NULL) {
+ if (!strcmp(av[2], "-v") && av[3] == NULL) {
+ VCLI_Out(cli, "Too few parameters");
+ VCLI_SetResult(cli, CLIS_TOOFEW);
+ return;
+ } else if (strcmp(av[2], "-v") && av[3] != NULL) {
VCLI_Out(cli, "Unknown options '%s'", av[2]);
VCLI_SetResult(cli, CLIS_PARAM);
return;
+ } else if (av[3] != NULL) {
+ verbose = 1;
+ vcl = vcl_find(av[3]);
} else
vcl = vcl_find(av[2]);
if (vcl == NULL) {
- VCLI_Out(cli, "No VCL named '%s'", av[2]);
+ VCLI_Out(cli, "No VCL named '%s'",
+ av[3] == NULL ? av[2] : av[3]);
VCLI_SetResult(cli, CLIS_PARAM);
return;
}
More information about the varnish-commit
mailing list