From 9c35a1cfb642c1d02cdfdc2290d9310606bdd72f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 1 May 2009 09:04:25 +0200 Subject: ifplugd: fix warnings --- networking/ifplugd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'networking/ifplugd.c') diff --git a/networking/ifplugd.c b/networking/ifplugd.c index c9f603f2c..62bc9d6d5 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c @@ -9,6 +9,7 @@ #include "libbb.h" #include +#include #include #include #include @@ -310,6 +311,7 @@ static void maybe_up_new_iface(void) static smallint detect_link_mii(void) { struct ifreq ifreq; + struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data; set_ifreq_to_ifname(&ifreq); @@ -318,20 +320,20 @@ static smallint detect_link_mii(void) return IFSTATUS_ERR; } - ((unsigned short*)&ifreq.ifr_data)[1] = 1; + mii->reg_num = 1; if (network_ioctl(SIOCGMIIREG, &ifreq) < 0) { bb_perror_msg("SIOCGMIIREG failed"); return IFSTATUS_ERR; } - return (((unsigned short*)&ifreq.ifr_data)[3] & 0x0004) ? - IFSTATUS_UP : IFSTATUS_DOWN; + return (mii->val_out & 0x0004) ? IFSTATUS_UP : IFSTATUS_DOWN; } static smallint detect_link_priv(void) { struct ifreq ifreq; + struct mii_ioctl_data *mii = (void *)&ifreq.ifr_data; set_ifreq_to_ifname(&ifreq); @@ -340,15 +342,14 @@ static smallint detect_link_priv(void) return IFSTATUS_ERR; } - ((unsigned short*) &ifreq.ifr_data)[1] = 1; + mii->reg_num = 1; if (network_ioctl(SIOCDEVPRIVATE+1, &ifreq) < 0) { bb_perror_msg("SIOCDEVPRIVATE+1 failed"); return IFSTATUS_ERR; } - return (((unsigned short*)&ifreq.ifr_data)[3] & 0x0004) ? - IFSTATUS_UP : IFSTATUS_DOWN; + return (mii->val_out & 0x0004) ? IFSTATUS_UP : IFSTATUS_DOWN; } static smallint detect_link_ethtool(void) @@ -591,6 +592,7 @@ static NOINLINE int netlink_open(void) return fd; } +#if ENABLE_FEATURE_PIDFILE static NOINLINE pid_t read_pid(const char *filename) { int len; @@ -604,6 +606,7 @@ static NOINLINE pid_t read_pid(const char *filename) } return 0; } +#endif int ifplugd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ifplugd_main(int argc UNUSED_PARAM, char **argv) -- cgit v1.2.3