networking/ifconfig.c type cast

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Sat May 17 08:04:40 UTC 2008


Is this necessary?

,----
| --- networking/ifconfig.c	(revision 21996)
| +++ networking/ifconfig.c	(working copy)
| @@ -514,7 +514,7 @@
|  	unsigned char c;
|
|  	sap->sa_family = ARPHRD_ETHER;
| -	ptr = (char *) sap->sa_data;
| +	ptr = sap->sa_data;
|
|  	i = 0;
|  	do {
`----

A few lines up in ifconfig.c, the function:

static int in_ether(const char *bufp, struct sockaddr *sap)

and:

	char *ptr;

sockaddr on my box is:

struct sockaddr
  {
    sa_family_t sa_family;
    char sa_data[14];
  };

It's:

struct osockaddr
  {
    unsigned short int sa_family;
    unsigned char sa_data[14];
  };

that has sa_data 'unsigned char'.  Did you mix up those two?


Cheers,

-- 
Cristian



More information about the busybox mailing list