diff options
author | Bernhard Reutner-Fischer | 2008-01-29 10:33:34 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer | 2008-01-29 10:33:34 +0000 |
commit | 8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15 (patch) | |
tree | 998a337ecd57b737423a3793365519213f97da72 /networking/ping.c | |
parent | c882f341cec8451ee87af6746abb7208272d5b1a (diff) | |
download | busybox-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.zip busybox-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.tar.gz |
- 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/ping.c')
-rw-r--r-- | networking/ping.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/networking/ping.c b/networking/ping.c index 0b33abf..382389d 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -209,7 +209,7 @@ int ping_main(int argc, char **argv) alarm(5); /* give the host 5000ms to respond */ #if ENABLE_PING6 - if (lsa->sa.sa_family == AF_INET6) + if (lsa->u.sa.sa_family == AF_INET6) ping6(lsa); else #endif @@ -532,12 +532,12 @@ static void ping4(len_and_sockaddr *lsa) int sockopt; pingsock = create_icmp_socket(); - pingaddr.sin = lsa->sin; + pingaddr.sin = lsa->u.sin; if (source_lsa) { if (setsockopt(pingsock, IPPROTO_IP, IP_MULTICAST_IF, - &source_lsa->sa, source_lsa->len)) + &source_lsa->u.sa, source_lsa->len)) bb_error_msg_and_die("can't set multicast source interface"); - xbind(pingsock, &source_lsa->sa, source_lsa->len); + xbind(pingsock, &source_lsa->u.sa, source_lsa->len); } if (opt_I) setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); @@ -584,10 +584,10 @@ static void ping6(len_and_sockaddr *lsa) char control_buf[CMSG_SPACE(36)]; pingsock = create_icmp6_socket(); - pingaddr.sin6 = lsa->sin6; + pingaddr.sin6 = lsa->u.sin6; /* untested whether "-I addr" really works for IPv6: */ if (source_lsa) - xbind(pingsock, &source_lsa->sa, source_lsa->len); + xbind(pingsock, &source_lsa->u.sa, source_lsa->len); if (opt_I) setsockopt(pingsock, SOL_SOCKET, SO_BINDTODEVICE, opt_I, strlen(opt_I) + 1); @@ -670,12 +670,12 @@ static void ping(len_and_sockaddr *lsa) printf("PING %s (%s)", hostname, dotted); if (source_lsa) { printf(" from %s", - xmalloc_sockaddr2dotted_noport(&source_lsa->sa)); + xmalloc_sockaddr2dotted_noport(&source_lsa->u.sa)); } printf(": %d data bytes\n", datalen); #if ENABLE_PING6 - if (lsa->sa.sa_family == AF_INET6) + if (lsa->u.sa.sa_family == AF_INET6) ping6(lsa); else #endif @@ -720,11 +720,11 @@ int ping_main(int argc, char **argv) lsa = xhost_and_af2sockaddr(hostname, 0, AF_INET); #endif - if (source_lsa && source_lsa->sa.sa_family != lsa->sa.sa_family) + if (source_lsa && source_lsa->u.sa.sa_family != lsa->u.sa.sa_family) /* leaking it here... */ source_lsa = NULL; - dotted = xmalloc_sockaddr2dotted_noport(&lsa->sa); + dotted = xmalloc_sockaddr2dotted_noport(&lsa->u.sa); ping(lsa); pingstats(0); return EXIT_SUCCESS; |