[master] b1b8114 Clean up a couple of places which assume to much about suckaddr.

Poul-Henning Kamp phk at varnish-cache.org
Mon Oct 28 09:45:36 CET 2013


commit b1b811400ddb275aa6aac3831e95200ad6539e0f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Oct 28 08:43:37 2013 +0000

    Clean up a couple of places which assume to much about suckaddr.

diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index 282d5f5..989c4c0 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -213,6 +213,8 @@ VTCP_connect(int s, const struct suckaddr *name, int msec)
 	int i, k;
 	socklen_t l;
 	struct pollfd fds[1];
+	const struct sockaddr *sa;
+	socklen_t sl;
 
 	assert(s >= 0);
 
@@ -221,8 +223,9 @@ VTCP_connect(int s, const struct suckaddr *name, int msec)
 		(void)VTCP_nonblocking(s);
 
 	/* Attempt the connect */
-	assert(VSA_Sane(name));
-	i = connect(s, (const void *)name, VSA_Len(name));
+	AN(VSA_Sane(name));
+	sa = VSA_Get_Sockaddr(name, &sl);
+	i = connect(s, sa, sl);
 	if (i == 0 || errno != EINPROGRESS)
 		return (i);
 
diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c
index aa82bc8..e756360 100644
--- a/lib/libvcc/vcc_utils.c
+++ b/lib/libvcc/vcc_utils.c
@@ -102,7 +102,6 @@ vcc_sockaddr(struct vcc *tl, const void *sa, unsigned sal)
 
 	assert(sizeof(unsigned long long) == 8);
 
-	assert(VSA_Sane(sa));
 	AN(sa);
 	AN(sal);
 



More information about the varnish-commit mailing list