[master] 5bfbb6c Also make vcl_dir act as path for the vcl.load command
Poul-Henning Kamp
phk at FreeBSD.org
Fri Jan 8 20:02:14 CET 2016
commit 5bfbb6c91a5737518cbd453805ec75f9cb6c1c01
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Jan 8 19:01:48 2016 +0000
Also make vcl_dir act as path for the vcl.load command
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 37359f2..7d51690 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -60,6 +60,7 @@ struct vclprog {
static VTAILQ_HEAD(, vclprog) vclhead = VTAILQ_HEAD_INITIALIZER(vclhead);
static struct vclprog *active_vcl;
static struct vev *e_poker;
+static struct vfil_path *vcl_path;
/*--------------------------------------------------------------------*/
@@ -269,7 +270,7 @@ mcf_vcl_inline(struct cli *cli, const char * const *av, void *priv)
void
mcf_vcl_load(struct cli *cli, const char * const *av, void *priv)
{
- char *vcl;
+ char *vcl, *fn;
struct vclprog *vp;
(void)priv;
@@ -280,9 +281,10 @@ mcf_vcl_load(struct cli *cli, const char * const *av, void *priv)
return;
}
- vcl = VFIL_readfile(mgt_vcl_dir, av[3], NULL);
- if (vcl == NULL) {
- VCLI_Out(cli, "Cannot open '%s'", av[3]);
+ VFIL_setpath(&vcl_path, mgt_vcl_dir);
+ fn = TRUST_ME(av[3]);
+ if (VFIL_searchpath(vcl_path, NULL, &vcl, &fn)) {
+ VCLI_Out(cli, "Cannot open '%s'", fn != NULL ? fn : av[3]);
VCLI_SetResult(cli, CLIS_PARAM);
return;
}
More information about the varnish-commit
mailing list