diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-13 14:50:20 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-13 14:50:20 +0200 |
commit | ab3964db4e75e34f6f9347406c5fd2bced04f2dd (patch) | |
tree | 92113e4a008338ed8534858db97d3a5e09dc210b /networking/ping.c | |
parent | f7ad927c2059ef9cd1cd6befeb43f26b92f6369f (diff) | |
download | busybox-w32-ab3964db4e75e34f6f9347406c5fd2bced04f2dd.tar.gz busybox-w32-ab3964db4e75e34f6f9347406c5fd2bced04f2dd.tar.bz2 busybox-w32-ab3964db4e75e34f6f9347406c5fd2bced04f2dd.zip |
libbb: introduce kernel-style BUILD_BUG_ON()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ping.c')
-rw-r--r-- | networking/ping.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/networking/ping.c b/networking/ping.c index dcbf19682..0eb1ae799 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -396,10 +396,8 @@ struct globals { | |||
396 | #define dotted (G.dotted ) | 396 | #define dotted (G.dotted ) |
397 | #define pingaddr (G.pingaddr ) | 397 | #define pingaddr (G.pingaddr ) |
398 | #define rcvd_tbl (G.rcvd_tbl ) | 398 | #define rcvd_tbl (G.rcvd_tbl ) |
399 | void BUG_ping_globals_too_big(void); | ||
400 | #define INIT_G() do { \ | 399 | #define INIT_G() do { \ |
401 | if (sizeof(G) > COMMON_BUFSIZE) \ | 400 | BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ |
402 | BUG_ping_globals_too_big(); \ | ||
403 | datalen = DEFDATALEN; \ | 401 | datalen = DEFDATALEN; \ |
404 | timeout = MAXWAIT; \ | 402 | timeout = MAXWAIT; \ |
405 | tmin = UINT_MAX; \ | 403 | tmin = UINT_MAX; \ |
@@ -732,7 +730,6 @@ static void ping4(len_and_sockaddr *lsa) | |||
732 | } | 730 | } |
733 | } | 731 | } |
734 | #if ENABLE_PING6 | 732 | #if ENABLE_PING6 |
735 | extern int BUG_bad_offsetof_icmp6_cksum(void); | ||
736 | static void ping6(len_and_sockaddr *lsa) | 733 | static void ping6(len_and_sockaddr *lsa) |
737 | { | 734 | { |
738 | int sockopt; | 735 | int sockopt; |
@@ -769,8 +766,7 @@ static void ping6(len_and_sockaddr *lsa) | |||
769 | setsockopt_SOL_SOCKET_int(pingsock, SO_RCVBUF, sockopt); | 766 | setsockopt_SOL_SOCKET_int(pingsock, SO_RCVBUF, sockopt); |
770 | 767 | ||
771 | sockopt = offsetof(struct icmp6_hdr, icmp6_cksum); | 768 | sockopt = offsetof(struct icmp6_hdr, icmp6_cksum); |
772 | if (offsetof(struct icmp6_hdr, icmp6_cksum) != 2) | 769 | BUILD_BUG_ON(offsetof(struct icmp6_hdr, icmp6_cksum) != 2); |
773 | BUG_bad_offsetof_icmp6_cksum(); | ||
774 | setsockopt_int(pingsock, SOL_RAW, IPV6_CHECKSUM, sockopt); | 770 | setsockopt_int(pingsock, SOL_RAW, IPV6_CHECKSUM, sockopt); |
775 | 771 | ||
776 | /* request ttl info to be returned in ancillary data */ | 772 | /* request ttl info to be returned in ancillary data */ |