something to warry about...

Sergey Naumov sknaumov at gmail.com
Tue Jan 18 13:09:14 UTC 2011


2011/1/18 Johannes Stezenbach <js at sig21.net>:
> The following compiles cleanly (but not tested):
>
>  /* Link detection routines and table */
>
> +union mii_ifreq {
> +       struct ifreq ifreq;
> +       struct mii_ioctl_data mii;
> +};
> +

Denys has already thought about this solution:
> union {
>       struct ifreq ifreq;
>       struct {
>               char padding[offsetof(struct ifreq, ifr_data)];
>               struct mii_ioctl_data mii;
>       } s;
>} u;

If struct mii_ioctl_data (or union ifr_ifru) was the first element of
struct ifreq you could use this solution, but it wasn't.

Sergey Naumov.


More information about the busybox mailing list