r5094 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Wed Aug 11 22:08:30 CEST 2010


Author: phk
Date: 2010-08-11 22:08:29 +0200 (Wed, 11 Aug 2010)
New Revision: 5094

Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c
Log:
Properly eliminate NULL pointer printing in backend ID.



Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-08-11 19:44:00 UTC (rev 5093)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2010-08-11 20:08:29 UTC (rev 5094)
@@ -476,6 +476,7 @@
 {
 	struct vdi_simple *vs;
 
+	ASSERT_CLI();
 	CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC);
 	CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC);
 

Modified: trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c	2010-08-11 19:44:00 UTC (rev 5093)
+++ trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c	2010-08-11 20:08:29 UTC (rev 5094)
@@ -102,10 +102,12 @@
 	int i;
 	struct vbc *vbe, *vbe2;
 
+	ASSERT_CLI();
 	CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC);
 	assert(b->refcount > 0);
 
 	i = --b->refcount;
+	b->vsc->vcls--;
 	Lck_Unlock(&b->mtx);
 	if (i > 0)
 		return;
@@ -191,6 +193,7 @@
 		    memcmp(b->ipv6, vb->ipv6_sockaddr + 1, b->ipv6len)))
 			continue;
 		b->refcount++;
+		b->vsc->vcls++;
 		return (b);
 	}
 
@@ -201,9 +204,12 @@
 	b->refcount = 1;
 
 	bprintf(buf, "%s(%s,%s,%s)",
-	    vb->vcl_name, vb->ipv4_addr, vb->ipv6_addr, vb->port);
+	    vb->vcl_name,
+	    vb->ipv4_addr == NULL ? "" : vb->ipv4_addr,
+	    vb->ipv6_addr == NULL ? "" : vb->ipv6_addr, vb->port);
 
 	b->vsc = VSM_Alloc(sizeof *b->vsc, VSC_CLASS, VSC_TYPE_VBE, buf);
+	b->vsc->vcls++;
 
 	VTAILQ_INIT(&b->connlist);
 




More information about the varnish-commit mailing list