[master] 5d28479 Fix vcl.show -v handling with no VCL
Federico G. Schwindt
fgsch at lodoss.net
Mon Jan 12 19:34:53 CET 2015
commit 5d28479654464b5fe0c61a532a7c5a7557005296
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 d0fc13e..e401da1 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -392,18 +392,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