[4.1] d7e898c Fix up a couple of straggling issues with include "./xxx"; If we know the filename of the -f argument, it should be possible to include "./" relative to it.

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


commit d7e898c0479a8ad739ef645b6f0d1c3380797e48
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Jan 8 22:31:49 2016 +0000

    Fix up a couple of straggling issues with include "./xxx";  If we
    know the filename of the -f argument, it should be possible to
    include "./" relative to it.
    
    The footnote is that the include is resolved at lower privlevel
    than the -f file is read, so in really obscure cases you could
    have really obscure error messages.

diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index a31bc6a..1aeba55 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -165,8 +165,8 @@ char *mgt_VccCompile(struct cli *, const char *vclname, const char *vclsrc,
 void mgt_vcc_init(void);
 
 void mgt_vcl_init(void);
-void mgt_vcc_default(struct cli *, const char *b_arg, const char *vclsrc,
-    int Cflag);
+void mgt_vcc_startup(struct cli *, const char *b_arg, const char *f_arg,
+    const char *vclsrc, int Cflag);
 int mgt_push_vcls_and_start(unsigned *status, char **p);
 int mgt_has_vcl(void);
 extern char *mgt_cc_cmd;
diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index a7533e9..dab70fb 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -752,7 +752,7 @@ main(int argc, char * const *argv)
 	mgt_vcl_init();
 
 	if (b_arg != NULL || f_arg != NULL) {
-		mgt_vcc_default(cli, b_arg, vcl, C_flag);
+		mgt_vcc_startup(cli, b_arg, f_arg, vcl, C_flag);
 		if (C_flag && cli->result == CLIS_OK) {
 			AZ(VSB_finish(cli->sb));
 			fprintf(stderr, "%s\n", VSB_data(cli->sb));
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 0b24c65..498c0b8 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -201,14 +201,15 @@ mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc,
 /*--------------------------------------------------------------------*/
 
 void
-mgt_vcc_default(struct cli *cli, const char *b_arg, const char *vclsrc,
-    int C_flag)
+mgt_vcc_startup(struct cli *cli, const char *b_arg, const char *f_arg,
+    const char *vclsrc, int C_flag)
 {
 	char buf[BUFSIZ];
 
 	if (b_arg == NULL) {
 		AN(vclsrc);
-		mgt_new_vcl(cli, "boot", vclsrc, NULL, NULL, C_flag);
+		AN(f_arg);
+		mgt_new_vcl(cli, "boot", vclsrc, f_arg, NULL, C_flag);
 		return;
 	}
 
@@ -218,7 +219,7 @@ mgt_vcc_default(struct cli *cli, const char *b_arg, const char *vclsrc,
 	    "backend default {\n"
 	    "    .host = \"%s\";\n"
 	    "}\n", b_arg);
-	mgt_new_vcl(cli, "boot", buf, NULL, NULL, C_flag);
+	mgt_new_vcl(cli, "boot", buf, "<-b argument>", NULL, C_flag);
 }
 
 /*--------------------------------------------------------------------*/
@@ -262,7 +263,7 @@ mcf_vcl_inline(struct cli *cli, const char * const *av, void *priv)
 		return;
 	}
 
-	mgt_new_vcl(cli, av[2], av[3], NULL, av[4], 0);
+	mgt_new_vcl(cli, av[2], av[3], "<vcl.inline>", av[4], 0);
 }
 
 void



More information about the varnish-commit mailing list