Mailing List Archive

r1392 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2007-05-09 11:44:35 +0200 (Wed, 09 May 2007)
New Revision: 1392

Modified:
trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c
Log:
Don't use sockaddr->sa_len, it was too advanced for POSIX people.


Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c 2007-05-09 08:44:28 UTC (rev 1391)
+++ trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c 2007-05-09 09:44:35 UTC (rev 1392)
@@ -88,12 +88,10 @@
struct addrinfo *a1;
struct sockaddr_in *sin1, *sin2;

- if (sa->sa_family == AF_INET) {
- assert(sa->sa_len >= sizeof *sin1);
+ if (sa->sa_family == AF_INET)
sin1 = (void*)sa;
- } else {
+ else
sin1 = NULL;
- }

for ( ; ap->name != NULL; ap++) {
if (ap->priv == NULL && ap->paren)
r1392 - trunk/varnish-cache/bin/varnishd [ In reply to ]
phk at projects.linpro.no writes:
> Modified:
> trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c
> Log:
> Don't use sockaddr->sa_len, it was too advanced for POSIX people.

Actually, our configure script checks for its presence - you can test
for it in code with "#if HAVE_STRUCT_SOCKADDR_SA_LEN".

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no
r1392 - trunk/varnish-cache/bin/varnishd [ In reply to ]
In message <87y7jynw6v.fsf at des.linpro.no>, Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?=
writes:
>phk at projects.linpro.no writes:
>> Modified:
>> trunk/varnish-cache/bin/varnishd/cache_vrt_acl.c
>> Log:
>> Don't use sockaddr->sa_len, it was too advanced for POSIX people.
>
>Actually, our configure script checks for its presence - you can test
>for it in code with "#if HAVE_STRUCT_SOCKADDR_SA_LEN".

It's easier and cleaner looking to assume it's not there.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.