[4.1] 35a5f63 Also make vcl_dir act as path for the vcl.load command

Lasse Karstensen lkarsten at varnish-software.com
Thu Jan 14 15:15:12 CET 2016


commit 35a5f6360f6063727d064a9e9597ef37925dc33f
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