From 8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 29 Jan 2008 10:33:34 +0000 Subject: - 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. --- networking/httpd.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'networking/httpd.c') 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); } -- cgit v1.2.3