diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-20 01:20:36 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-20 01:20:36 +0100 |
commit | 53f30b41ec252d9973719b349a644477e72e1a09 (patch) | |
tree | 428ee573995ad124668d8ea82a3fd6e5e1903bfb | |
parent | 9ad97d504146db2ea6b6a1a23c96ca052c50e270 (diff) | |
download | busybox-w32-53f30b41ec252d9973719b349a644477e72e1a09.tar.gz busybox-w32-53f30b41ec252d9973719b349a644477e72e1a09.tar.bz2 busybox-w32-53f30b41ec252d9973719b349a644477e72e1a09.zip |
ifplugd: eliminate aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-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 58f56dbf1..3b59a63ff 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c | |||
@@ -131,18 +131,20 @@ static int network_ioctl(int request, void* data, const char *errmsg) | |||
131 | 131 | ||
132 | static smallint detect_link_mii(void) | 132 | static smallint detect_link_mii(void) |
133 | { | 133 | { |
134 | struct ifreq ifreq; | 134 | /* char buffer instead of bona-fide struct avoids aliasing warning */ |
135 | struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data; | 135 | char buf[sizeof(struct ifreq)]; |
136 | struct ifreq *ifreq = (void *)buf; | ||
137 | struct mii_ioctl_data *mii = (void *)&ifreq->ifr_data; | ||
136 | 138 | ||
137 | set_ifreq_to_ifname(&ifreq); | 139 | set_ifreq_to_ifname(ifreq); |
138 | 140 | ||
139 | if (network_ioctl(SIOCGMIIPHY, &ifreq, "SIOCGMIIPHY") < 0) { | 141 | if (network_ioctl(SIOCGMIIPHY, ifreq, "SIOCGMIIPHY") < 0) { |
140 | return IFSTATUS_ERR; | 142 | return IFSTATUS_ERR; |
141 | } | 143 | } |
142 | 144 | ||
143 | mii->reg_num = 1; | 145 | mii->reg_num = 1; |
144 | 146 | ||
145 | if (network_ioctl(SIOCGMIIREG, &ifreq, "SIOCGMIIREG") < 0) { | 147 | if (network_ioctl(SIOCGMIIREG, ifreq, "SIOCGMIIREG") < 0) { |
146 | return IFSTATUS_ERR; | 148 | return IFSTATUS_ERR; |
147 | } | 149 | } |
148 | 150 | ||
@@ -151,18 +153,20 @@ static smallint detect_link_mii(void) | |||
151 | 153 | ||
152 | static smallint detect_link_priv(void) | 154 | static smallint detect_link_priv(void) |
153 | { | 155 | { |
154 | struct ifreq ifreq; | 156 | /* char buffer instead of bona-fide struct avoids aliasing warning */ |
155 | struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data; | 157 | char buf[sizeof(struct ifreq)]; |
158 | struct ifreq *ifreq = (void *)buf; | ||
159 | struct mii_ioctl_data *mii = (void *)&ifreq->ifr_data; | ||
156 | 160 | ||
157 | set_ifreq_to_ifname(&ifreq); | 161 | set_ifreq_to_ifname(ifreq); |
158 | 162 | ||
159 | if (network_ioctl(SIOCDEVPRIVATE, &ifreq, "SIOCDEVPRIVATE") < 0) { | 163 | if (network_ioctl(SIOCDEVPRIVATE, ifreq, "SIOCDEVPRIVATE") < 0) { |
160 | return IFSTATUS_ERR; | 164 | return IFSTATUS_ERR; |
161 | } | 165 | } |
162 | 166 | ||
163 | mii->reg_num = 1; | 167 | mii->reg_num = 1; |
164 | 168 | ||
165 | if (network_ioctl(SIOCDEVPRIVATE+1, &ifreq, "SIOCDEVPRIVATE+1") < 0) { | 169 | if (network_ioctl(SIOCDEVPRIVATE+1, ifreq, "SIOCDEVPRIVATE+1") < 0) { |
166 | return IFSTATUS_ERR; | 170 | return IFSTATUS_ERR; |
167 | } | 171 | } |
168 | 172 | ||