[master] ffdeafe Always initialise vd->dname

Federico G. Schwindt fgsch at lodoss.net
Tue Sep 5 01:56:06 CEST 2017


commit ffdeafe345670b8e213a4b4a68f0674ee519264d
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Tue Sep 5 00:40:53 2017 +0100

    Always initialise vd->dname
    
    This was lost in commit 74328de8eeb2703591fe59190f73fcabf057adbe.
    Fixes #2412.

diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index ebca6f2..235c9e0 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -531,7 +531,7 @@ VSM_Attach(struct vsm *vd, int progress)
 {
 	double t0;
 	unsigned u;
-	int n = 0;
+	int i, n = 0;
 
 	CHECK_OBJ_NOTNULL(vd, VSM_MAGIC);
 
@@ -540,6 +540,14 @@ VSM_Attach(struct vsm *vd, int progress)
 	else
 		t0 = VTIM_mono() + vd->patience;
 
+	if (vd->dname == NULL) {
+		/* Use default (hostname) */
+		i = VSM_Arg(vd, 'n', "");
+		if (i < 0)
+			return (i);
+		AN(vd->dname);
+	}
+
 	AZ(vd->attached);
 	while (1) {
 		u = VSM_Status(vd);



More information about the varnish-commit mailing list