diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-01-29 13:33:34 +0300 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-01-29 13:33:34 +0300 |
commit | 8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15 (patch) | |
tree | 998a337ecd57b737423a3793365519213f97da72 /networking/httpd.c | |
parent | c882f341cec8451ee87af6746abb7208272d5b1a (diff) |
- be C99 friendly. Anonymous unions are a GNU extension. This change is
size-neutral WRT -std=gnu99 and fixes several compilation errors for strict
C99 mode.
Diffstat (limited to 'networking/httpd.c')
-rw-r--r-- | networking/httpd.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index 72949755a..0f18b0fd0 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -1781,18 +1781,18 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) iobuf = xmalloc(IOBUF_SIZE); rmt_ip = 0; - if (fromAddr->sa.sa_family == AF_INET) { - rmt_ip = ntohl(fromAddr->sin.sin_addr.s_addr); + if (fromAddr->u.sa.sa_family == AF_INET) { + rmt_ip = ntohl(fromAddr->u.sin.sin_addr.s_addr); } #if ENABLE_FEATURE_IPV6 - if (fromAddr->sa.sa_family == AF_INET6 - && fromAddr->sin6.sin6_addr.s6_addr32[0] == 0 - && fromAddr->sin6.sin6_addr.s6_addr32[1] == 0 - && ntohl(fromAddr->sin6.sin6_addr.s6_addr32[2]) == 0xffff) - rmt_ip = ntohl(fromAddr->sin6.sin6_addr.s6_addr32[3]); + if (fromAddr->u.sa.sa_family == AF_INET6 + && fromAddr->u.sin6.sin6_addr.s6_addr32[0] == 0 + && fromAddr->u.sin6.sin6_addr.s6_addr32[1] == 0 + && ntohl(fromAddr->u.sin6.sin6_addr.s6_addr32[2]) == 0xffff) + rmt_ip = ntohl(fromAddr->u.sin6.sin6_addr.s6_addr32[3]); #endif if (ENABLE_FEATURE_HTTPD_CGI || DEBUG || verbose) { - rmt_ip_str = xmalloc_sockaddr2dotted(&fromAddr->sa); + rmt_ip_str = xmalloc_sockaddr2dotted(&fromAddr->u.sa); } if (verbose) { /* this trick makes -v logging much simpler */ @@ -2047,7 +2047,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr) lsa = host2sockaddr(proxy_entry->host_port, 80); if (lsa == NULL) send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR); - if (connect(proxy_fd, &lsa->sa, lsa->len) < 0) + if (connect(proxy_fd, &lsa->u.sa, lsa->len) < 0) send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR); fdprintf(proxy_fd, "%s %s%s%s%s HTTP/%c.%c\r\n", prequest, /* GET or POST */ @@ -2140,7 +2140,7 @@ static void mini_httpd(int server_socket) /* Wait for connections... */ fromAddr.len = LSA_SIZEOF_SA; - n = accept(server_socket, &fromAddr.sa, &fromAddr.len); + n = accept(server_socket, &fromAddr.u.sa, &fromAddr.len); if (n < 0) continue; @@ -2222,7 +2222,7 @@ static void mini_httpd_inetd(void) len_and_sockaddr fromAddr; fromAddr.len = LSA_SIZEOF_SA; - getpeername(0, &fromAddr.sa, &fromAddr.len); + getpeername(0, &fromAddr.u.sa, &fromAddr.len); handle_incoming_and_exit(&fromAddr); } |