From: Junio C Hamano Date: Sat, 3 Apr 2010 19:28:39 +0000 (-0700) Subject: Merge branch 'bc/maint-daemon-sans-ss-family' X-Git-Tag: v1.7.1-rc0~22 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d718dd0732c125306670d61880652f1b596a0c3e?hp=-c 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 --- d718dd0732c125306670d61880652f1b596a0c3e diff --combined daemon.c index 7d9e1c03e8,2e6766fd0e..a90ab10505 --- a/daemon.c +++ b/daemon.c @@@ -420,7 -420,7 +420,7 @@@ static void parse_host_and_port(char *h *host = hostport; *port = strrchr(hostport, ':'); if (*port) { - *port = '\0'; + **port = '\0'; ++*port; } } @@@ -590,14 -590,17 +590,17 @@@ static int execute(struct sockaddr *add 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));