[4.1] 11d46e7 Qualify the -C test-vcl name with the PID of the process, so two concurrent -C tests don't collided.

Lasse Karstensen lkarsten at varnish-software.com
Mon Jan 18 17:38:16 CET 2016


commit 11d46e757219603f2898f466e100d0ac623a1e59
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 18 14:37:24 2016 +0000

    Qualify the -C test-vcl name with the PID of the process, so two
    concurrent -C tests don't collided.
    
    Problem spotted by:	fgs

diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index e533c69..65b50bf 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -163,11 +163,14 @@ mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc,
 	unsigned status;
 	char *lib, *p;
 	struct vclprog *vp;
+	char buf[32];
 
 	AN(cli);
 
-	if (C_flag)
-		vclname = ".Cflagtest";
+	if (C_flag) {
+		bprintf(buf, ".CflagTest.%d", (int)getpid());
+		vclname = buf;
+	}
 
 	if (state == NULL)
 		state = "auto";
@@ -183,6 +186,7 @@ mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc,
 	if (lib == NULL)
 		return;
 
+	AZ(C_flag);
 	vp = mgt_vcl_add(vclname, lib, state);
 	free(lib);
 



More information about the varnish-commit mailing list