[master] adf3f12 Report the right token in the error message.

Poul-Henning Kamp phk at varnish-cache.org
Mon Jul 15 10:38:27 CEST 2013


commit adf3f128e661bd5d7a55edcb30a3b964c18b1a7a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jul 15 08:38:03 2013 +0000

    Report the right token in the error message.
    
    Fixes #1322

diff --git a/bin/varnishtest/tests/v00021.vtc b/bin/varnishtest/tests/v00021.vtc
index 697de15..a8c20b5 100644
--- a/bin/varnishtest/tests/v00021.vtc
+++ b/bin/varnishtest/tests/v00021.vtc
@@ -54,8 +54,6 @@ varnish v1 -errvcl {Unused sub foo, defined:} {
 	sub foo {
 	}
 }
-
-
 varnish v1 -errvcl {Invalid return "deliver"} {
 	backend b { .host = "127.0.0.1"; }
 
@@ -67,3 +65,15 @@ varnish v1 -errvcl {Invalid return "deliver"} {
 		return (deliver);
 	}
 }
+
+varnish v1 -errvcl {directors are now in VMOD.directors} {
+	backend b { .host = "127.0.0.1"; }
+
+	director d1 random {
+		.backend b;
+	}
+
+	sub vcl_recv {
+		set req.backend = d1;
+	}
+}
diff --git a/lib/libvcl/vcc_backend.c b/lib/libvcl/vcc_backend.c
index d5f216e..09604cb 100644
--- a/lib/libvcl/vcc_backend.c
+++ b/lib/libvcl/vcc_backend.c
@@ -658,12 +658,11 @@ vcc_ParseDirector(struct vcc *tl)
 
 	isfirst = tl->ndirector;
 	if (vcc_IdIs(t_first, "backend")) {
-		tl->t_policy = t_first;
 		vcc_ParseSimpleDirector(tl);
 	} else {
 		VSB_printf(tl->sb,
 		    "\ndirectors are now in VMOD.directors\n");
-		vcc_ErrWhere(tl, tl->t_policy);
+		vcc_ErrWhere(tl, t_first);
 		return;
 	}
 	if (tl->err) {
@@ -678,6 +677,5 @@ vcc_ParseDirector(struct vcc *tl)
 		tl->t_defaultdir = tl->t_dir;
 	}
 
-	tl->t_policy = NULL;
 	tl->t_dir = NULL;
 }
diff --git a/lib/libvcl/vcc_compile.h b/lib/libvcl/vcc_compile.h
index 64b5995..feb993a 100644
--- a/lib/libvcl/vcc_compile.h
+++ b/lib/libvcl/vcc_compile.h
@@ -191,7 +191,6 @@ struct vcc {
 	int			defaultdir;
 	struct token		*t_defaultdir;
 	struct token		*t_dir;
-	struct token		*t_policy;
 
 	unsigned		unique;
 	unsigned		nvmodpriv;



More information about the varnish-commit mailing list