aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-05 14:40:23 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-05 14:40:23 +0100
commit36659fda1f05e735839b22d9e8892731fb46d7b0 (patch)
treed4e24cbd45d18ea1aa58cbb0d76aa9a69869db00
parent12ca080a1ca8dfd0aeac54485451b906a7e61b16 (diff)
downloadbusybox-w32-36659fda1f05e735839b22d9e8892731fb46d7b0.tar.gz
busybox-w32-36659fda1f05e735839b22d9e8892731fb46d7b0.tar.bz2
busybox-w32-36659fda1f05e735839b22d9e8892731fb46d7b0.zip
*: fix 1/4 remaining aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/libiproute/ipaddress.c5
-rw-r--r--networking/libiproute/iproute.c5
-rw-r--r--networking/netstat.c55
-rw-r--r--util-linux/fdisk.c5
4 files changed, 34 insertions, 36 deletions
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index f2e340a42..af29dd301 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -23,7 +23,7 @@
23#define IFF_LOWER_UP 0x10000 /* driver signals L1 up*/ 23#define IFF_LOWER_UP 0x10000 /* driver signals L1 up*/
24#endif 24#endif
25 25
26typedef struct filter_t { 26struct filter_t {
27 char *label; 27 char *label;
28 char *flushb; 28 char *flushb;
29 struct rtnl_handle *rth; 29 struct rtnl_handle *rth;
@@ -38,7 +38,8 @@ typedef struct filter_t {
38 smallint up; 38 smallint up;
39 smallint flushed; 39 smallint flushed;
40 inet_prefix pfx; 40 inet_prefix pfx;
41} filter_t; 41} FIX_ALIASING;
42typedef struct filter_t filter_t;
42 43
43#define G_filter (*(filter_t*)&bb_common_bufsiz1) 44#define G_filter (*(filter_t*)&bb_common_bufsiz1)
44 45
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 520cc820a..68e3c36a0 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -22,7 +22,7 @@
22#endif 22#endif
23 23
24 24
25typedef struct filter_t { 25struct filter_t {
26 int tb; 26 int tb;
27 smallint flushed; 27 smallint flushed;
28 char *flushb; 28 char *flushb;
@@ -43,7 +43,8 @@ typedef struct filter_t {
43 inet_prefix mdst; 43 inet_prefix mdst;
44 inet_prefix rsrc; 44 inet_prefix rsrc;
45 inet_prefix msrc; 45 inet_prefix msrc;
46} filter_t; 46} FIX_ALIASING;
47typedef struct filter_t filter_t;
47 48
48#define G_filter (*(filter_t*)&bb_common_bufsiz1) 49#define G_filter (*(filter_t*)&bb_common_bufsiz1)
49 50
diff --git a/networking/netstat.c b/networking/netstat.c
index 0c3f93191..149a81ee4 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -107,7 +107,6 @@ typedef enum {
107#define PRINT_NET_CONN_WIDE "%s %6ld %6ld %-51s %-51s %-12s" 107#define PRINT_NET_CONN_WIDE "%s %6ld %6ld %-51s %-51s %-12s"
108#define PRINT_NET_CONN_HEADER_WIDE "\nProto Recv-Q Send-Q %-51s %-51s State " 108#define PRINT_NET_CONN_HEADER_WIDE "\nProto Recv-Q Send-Q %-51s %-51s State "
109 109
110
111#define PROGNAME_WIDTH 20 110#define PROGNAME_WIDTH 20
112#define PROGNAME_WIDTH_STR "20" 111#define PROGNAME_WIDTH_STR "20"
113/* PROGNAME_WIDTH chars: 12345678901234567890 */ 112/* PROGNAME_WIDTH chars: 12345678901234567890 */
@@ -121,7 +120,6 @@ struct prg_node {
121 120
122#define PRG_HASH_SIZE 211 121#define PRG_HASH_SIZE 211
123 122
124
125struct globals { 123struct globals {
126 const char *net_conn_line; 124 const char *net_conn_line;
127 smallint flags; 125 smallint flags;
@@ -311,21 +309,16 @@ static void build_ipv6_addr(char* local_addr, struct sockaddr_in6* localaddr)
311 &in6.s6_addr32[0], &in6.s6_addr32[1], 309 &in6.s6_addr32[0], &in6.s6_addr32[1],
312 &in6.s6_addr32[2], &in6.s6_addr32[3]); 310 &in6.s6_addr32[2], &in6.s6_addr32[3]);
313 inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6)); 311 inet_ntop(AF_INET6, &in6, addr6, sizeof(addr6));
314 inet_pton(AF_INET6, addr6, (struct sockaddr *) &localaddr->sin6_addr); 312 inet_pton(AF_INET6, addr6, &localaddr->sin6_addr);
315 313
316 localaddr->sin6_family = AF_INET6; 314 localaddr->sin6_family = AF_INET6;
317} 315}
318#endif 316#endif
319 317
320#if ENABLE_FEATURE_IPV6
321static void build_ipv4_addr(char* local_addr, struct sockaddr_in6* localaddr)
322#else
323static void build_ipv4_addr(char* local_addr, struct sockaddr_in* localaddr) 318static void build_ipv4_addr(char* local_addr, struct sockaddr_in* localaddr)
324#endif
325{ 319{
326 sscanf(local_addr, "%X", 320 sscanf(local_addr, "%X", &localaddr->sin_addr.s_addr);
327 &((struct sockaddr_in *) localaddr)->sin_addr.s_addr); 321 localaddr->sin_family = AF_INET;
328 ((struct sockaddr *) localaddr)->sa_family = AF_INET;
329} 322}
330 323
331static const char *get_sname(int port, const char *proto, int numeric) 324static const char *get_sname(int port, const char *proto, int numeric)
@@ -358,11 +351,13 @@ static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int
358 351
359struct inet_params { 352struct inet_params {
360 int local_port, rem_port, state, uid; 353 int local_port, rem_port, state, uid;
354 union {
355 struct sockaddr sa;
356 struct sockaddr_in sin;
361#if ENABLE_FEATURE_IPV6 357#if ENABLE_FEATURE_IPV6
362 struct sockaddr_in6 localaddr, remaddr; 358 struct sockaddr_in6 sin6;
363#else
364 struct sockaddr_in localaddr, remaddr;
365#endif 359#endif
360 } localaddr, remaddr;
366 unsigned long rxq, txq, inode; 361 unsigned long rxq, txq, inode;
367}; 362};
368 363
@@ -386,12 +381,12 @@ static int scan_inet_proc_line(struct inet_params *param, char *line)
386 381
387 if (strlen(local_addr) > 8) { 382 if (strlen(local_addr) > 8) {
388#if ENABLE_FEATURE_IPV6 383#if ENABLE_FEATURE_IPV6
389 build_ipv6_addr(local_addr, &param->localaddr); 384 build_ipv6_addr(local_addr, &param->localaddr.sin6);
390 build_ipv6_addr(rem_addr, &param->remaddr); 385 build_ipv6_addr(rem_addr, &param->remaddr.sin6);
391#endif 386#endif
392 } else { 387 } else {
393 build_ipv4_addr(local_addr, &param->localaddr); 388 build_ipv4_addr(local_addr, &param->localaddr.sin);
394 build_ipv4_addr(rem_addr, &param->remaddr); 389 build_ipv4_addr(rem_addr, &param->remaddr.sin);
395 } 390 }
396 return 0; 391 return 0;
397} 392}
@@ -403,10 +398,10 @@ static void print_inet_line(struct inet_params *param,
403 || (!is_connected && (flags & NETSTAT_LISTENING)) 398 || (!is_connected && (flags & NETSTAT_LISTENING))
404 ) { 399 ) {
405 char *l = ip_port_str( 400 char *l = ip_port_str(
406 (struct sockaddr *) &param->localaddr, param->local_port, 401 &param->localaddr.sa, param->local_port,
407 proto, flags & NETSTAT_NUMERIC); 402 proto, flags & NETSTAT_NUMERIC);
408 char *r = ip_port_str( 403 char *r = ip_port_str(
409 (struct sockaddr *) &param->remaddr, param->rem_port, 404 &param->remaddr.sa, param->rem_port,
410 proto, flags & NETSTAT_NUMERIC); 405 proto, flags & NETSTAT_NUMERIC);
411 printf(net_conn_line, 406 printf(net_conn_line,
412 proto, param->rxq, param->txq, l, r, state_str); 407 proto, param->rxq, param->txq, l, r, state_str);
@@ -432,17 +427,17 @@ static int FAST_FUNC tcp_do_one(char *line)
432} 427}
433 428
434#if ENABLE_FEATURE_IPV6 429#if ENABLE_FEATURE_IPV6
435# define notnull(A) ( \ 430# define NOT_NULL_ADDR(A) ( \
436 ( (A.sin6_family == AF_INET6) \ 431 ( (A.sa.sa_family == AF_INET6) \
437 && (A.sin6_addr.s6_addr32[0] | A.sin6_addr.s6_addr32[1] | \ 432 && (A.sin6.sin6_addr.s6_addr32[0] | A.sin6.sin6_addr.s6_addr32[1] | \
438 A.sin6_addr.s6_addr32[2] | A.sin6_addr.s6_addr32[3]) \ 433 A.sin6.sin6_addr.s6_addr32[2] | A.sin6.sin6_addr.s6_addr32[3]) \
439 ) || ( \ 434 ) || ( \
440 (A.sin6_family == AF_INET) \ 435 (A.sa.sa_family == AF_INET) \
441 && ((struct sockaddr_in*)&A)->sin_addr.s_addr \ 436 && A.sin.sin_addr.s_addr != 0 \
442 ) \ 437 ) \
443) 438)
444#else 439#else
445# define notnull(A) (A.sin_addr.s_addr) 440# define NOT_NULL_ADDR(A) (A.sin_addr.s_addr)
446#endif 441#endif
447 442
448static int FAST_FUNC udp_do_one(char *line) 443static int FAST_FUNC udp_do_one(char *line)
@@ -464,7 +459,7 @@ static int FAST_FUNC udp_do_one(char *line)
464 break; 459 break;
465 } 460 }
466 461
467 have_remaddr = notnull(param.remaddr); 462 have_remaddr = NOT_NULL_ADDR(param.remaddr);
468 print_inet_line(&param, state_str, "udp", have_remaddr); 463 print_inet_line(&param, state_str, "udp", have_remaddr);
469 return 0; 464 return 0;
470} 465}
@@ -477,7 +472,7 @@ static int FAST_FUNC raw_do_one(char *line)
477 if (scan_inet_proc_line(&param, line)) 472 if (scan_inet_proc_line(&param, line))
478 return 1; 473 return 1;
479 474
480 have_remaddr = notnull(param.remaddr); 475 have_remaddr = NOT_NULL_ADDR(param.remaddr);
481 print_inet_line(&param, itoa(param.state), "raw", have_remaddr); 476 print_inet_line(&param, itoa(param.state), "raw", have_remaddr);
482 return 0; 477 return 0;
483} 478}
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index c9f57c6d6..a731316ce 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -625,7 +625,7 @@ write_sector(sector_t secno, const void *buf)
625 625
626#include "fdisk_aix.c" 626#include "fdisk_aix.c"
627 627
628typedef struct { 628struct sun_partition {
629 unsigned char info[128]; /* Informative text string */ 629 unsigned char info[128]; /* Informative text string */
630 unsigned char spare0[14]; 630 unsigned char spare0[14];
631 struct sun_info { 631 struct sun_info {
@@ -651,7 +651,8 @@ typedef struct {
651 } partitions[8]; 651 } partitions[8];
652 unsigned short magic; /* Magic number */ 652 unsigned short magic; /* Magic number */
653 unsigned short csum; /* Label xor'd checksum */ 653 unsigned short csum; /* Label xor'd checksum */
654} sun_partition; 654} FIX_ALIASING;
655typedef struct sun_partition sun_partition;
655#define sunlabel ((sun_partition *)MBRbuffer) 656#define sunlabel ((sun_partition *)MBRbuffer)
656STATIC_OSF void bsd_select(void); 657STATIC_OSF void bsd_select(void);
657STATIC_OSF void xbsd_print_disklabel(int); 658STATIC_OSF void xbsd_print_disklabel(int);