diff options
author | Denys Vlasenko | 2011-01-20 01:20:36 +0100 |
---|---|---|
committer | Denys Vlasenko | 2011-01-20 01:20:36 +0100 |
commit | 53f30b41ec252d9973719b349a644477e72e1a09 (patch) | |
tree | 428ee573995ad124668d8ea82a3fd6e5e1903bfb /networking/ifplugd.c | |
parent | 9ad97d504146db2ea6b6a1a23c96ca052c50e270 (diff) | |
download | busybox-53f30b41ec252d9973719b349a644477e72e1a09.zip busybox-53f30b41ec252d9973719b349a644477e72e1a09.tar.gz |
ifplugd: eliminate aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ifplugd.c')
-rw-r--r-- | networking/ifplugd.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/networking/ifplugd.c b/networking/ifplugd.c index 58f56db..3b59a63 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c @@ -131,18 +131,20 @@ static int network_ioctl(int request, void* data, const char *errmsg) static smallint detect_link_mii(void) { - struct ifreq ifreq; - struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data; + /* char buffer instead of bona-fide struct avoids aliasing warning */ + char buf[sizeof(struct ifreq)]; + struct ifreq *ifreq = (void *)buf; + struct mii_ioctl_data *mii = (void *)&ifreq->ifr_data; - set_ifreq_to_ifname(&ifreq); + set_ifreq_to_ifname(ifreq); - if (network_ioctl(SIOCGMIIPHY, &ifreq, "SIOCGMIIPHY") < 0) { + if (network_ioctl(SIOCGMIIPHY, ifreq, "SIOCGMIIPHY") < 0) { return IFSTATUS_ERR; } mii->reg_num = 1; - if (network_ioctl(SIOCGMIIREG, &ifreq, "SIOCGMIIREG") < 0) { + if (network_ioctl(SIOCGMIIREG, ifreq, "SIOCGMIIREG") < 0) { return IFSTATUS_ERR; } @@ -151,18 +153,20 @@ static smallint detect_link_mii(void) static smallint detect_link_priv(void) { - struct ifreq ifreq; - struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data; + /* char buffer instead of bona-fide struct avoids aliasing warning */ + char buf[sizeof(struct ifreq)]; + struct ifreq *ifreq = (void *)buf; + struct mii_ioctl_data *mii = (void *)&ifreq->ifr_data; - set_ifreq_to_ifname(&ifreq); + set_ifreq_to_ifname(ifreq); - if (network_ioctl(SIOCDEVPRIVATE, &ifreq, "SIOCDEVPRIVATE") < 0) { + if (network_ioctl(SIOCDEVPRIVATE, ifreq, "SIOCDEVPRIVATE") < 0) { return IFSTATUS_ERR; } mii->reg_num = 1; - if (network_ioctl(SIOCDEVPRIVATE+1, &ifreq, "SIOCDEVPRIVATE+1") < 0) { + if (network_ioctl(SIOCDEVPRIVATE+1, ifreq, "SIOCDEVPRIVATE+1") < 0) { return IFSTATUS_ERR; } |