r5397 - in trunk/varnish-cache: bin/varnishd lib/libvarnish

phk at varnish-cache.org phk at varnish-cache.org
Mon Oct 4 17:03:05 CEST 2010


Author: phk
Date: 2010-10-04 17:03:05 +0200 (Mon, 04 Oct 2010)
New Revision: 5397

Modified:
   trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c
   trunk/varnish-cache/bin/varnishd/common.h
   trunk/varnish-cache/lib/libvarnish/vss.c
Log:
More sockaddr->sockaddr_storage cleanup



Modified: trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c	2010-10-04 13:10:19 UTC (rev 5396)
+++ trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c	2010-10-04 15:03:05 UTC (rev 5397)
@@ -156,7 +156,7 @@
 {
 
 	assert(*src > 0);
-	*sa = malloc(*src);		/* XXX: malloc(sizeof **sa) ? */
+	*sa = malloc(*src);
 	XXXAN(*sa);
 	memcpy(*sa, src + 1, *src);
 	*len = *src;

Modified: trunk/varnish-cache/bin/varnishd/common.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/common.h	2010-10-04 13:10:19 UTC (rev 5396)
+++ trunk/varnish-cache/bin/varnishd/common.h	2010-10-04 15:03:05 UTC (rev 5397)
@@ -30,7 +30,6 @@
  */
 
 struct cli;
-struct sockaddr;
 
 extern pid_t mgt_pid;
 #define ASSERT_MGT() do { assert(getpid() == mgt_pid);} while (0)

Modified: trunk/varnish-cache/lib/libvarnish/vss.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vss.c	2010-10-04 13:10:19 UTC (rev 5396)
+++ trunk/varnish-cache/lib/libvarnish/vss.c	2010-10-04 15:03:05 UTC (rev 5397)
@@ -62,10 +62,7 @@
 	int			 va_socktype;
 	int			 va_protocol;
 	socklen_t		 va_addrlen;
-	union {
-		struct sockaddr_storage	 _storage;
-		struct sockaddr		 sa;
-	} va_addr;
+	struct sockaddr_storage	 va_addr;
 };
 
 /*lint -esym(754, _storage) not ref */
@@ -224,7 +221,7 @@
 		return (-1);
 	}
 #endif
-	if (bind(sd, &va->va_addr.sa, va->va_addrlen) != 0) {
+	if (bind(sd, (const void*)&va->va_addr, va->va_addrlen) != 0) {
 		perror("bind()");
 		(void)close(sd);
 		return (-1);
@@ -272,7 +269,7 @@
 	}
 	if (nonblock)
 		(void)TCP_nonblocking(sd);
-	i = connect(sd, &va->va_addr.sa, va->va_addrlen);
+	i = connect(sd, (const void *)&va->va_addr, va->va_addrlen);
 	if (i == 0 || (nonblock && errno == EINPROGRESS))
 		return (sd);
 	perror("connect()");




More information about the varnish-commit mailing list