diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-04-03 12:28:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-04-03 12:28:39 -0700 |
commit | d718dd0732c125306670d61880652f1b596a0c3e (patch) | |
tree | 356ed2b8fca5a96e55099c219a5026ccb1b69c2e /daemon.c | |
parent | a59cb82a2f77c510d62d7d27f197451545f386ab (diff) | |
parent | 3aff874af239965ea78c37d14266d6c2233ad431 (diff) | |
download | git-d718dd0732c125306670d61880652f1b596a0c3e.tar.gz |
Merge branch 'bc/maint-daemon-sans-ss-family'
* bc/maint-daemon-sans-ss-family:
daemon.c: avoid accessing ss_family member of struct sockaddr_storage
Diffstat (limited to 'daemon.c')
-rw-r--r-- | daemon.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -590,14 +590,17 @@ static int execute(struct sockaddr *addr) static int addrcmp(const struct sockaddr_storage *s1, const struct sockaddr_storage *s2) { - if (s1->ss_family != s2->ss_family) - return s1->ss_family - s2->ss_family; - if (s1->ss_family == AF_INET) + const struct sockaddr *sa1 = (const struct sockaddr*) s1; + const struct sockaddr *sa2 = (const struct sockaddr*) s2; + + if (sa1->sa_family != sa2->sa_family) + return sa1->sa_family - sa2->sa_family; + if (sa1->sa_family == AF_INET) return memcmp(&((struct sockaddr_in *)s1)->sin_addr, &((struct sockaddr_in *)s2)->sin_addr, sizeof(struct in_addr)); #ifndef NO_IPV6 - if (s1->ss_family == AF_INET6) + if (sa1->sa_family == AF_INET6) return memcmp(&((struct sockaddr_in6 *)s1)->sin6_addr, &((struct sockaddr_in6 *)s2)->sin6_addr, sizeof(struct in6_addr)); |