- sed -e "s/char[[:space:]]*\*[[:space:]]*argv\[\]/char **argv/g"
[oweals/busybox.git] / networking / ether-wake.c
index f870f6a5f3d86baba68bae9859c42dd09766c316..e971ba39c5b91e4dace1eef1c9b43432cb0e5944 100644 (file)
@@ -105,9 +105,11 @@ static inline void get_dest_addr(const char *arg, struct ether_addr *eaddr);
 static inline int get_fill(unsigned char *pkt, struct ether_addr *eaddr, int broadcast);
 static inline int get_wol_pw(const char *ethoptarg, unsigned char *wol_passwd);
 
-int ether_wake_main(int argc, char *argv[])
+int ether_wake_main(int argc, char **argv);
+int ether_wake_main(int argc, char **argv)
 {
-       char *ifname = "eth0", *pass = NULL;
+       const char *ifname = "eth0";
+       char *pass = NULL;
        unsigned long flags;
        unsigned char wol_passwd[6];
        int wol_passwd_sz = 0;
@@ -145,7 +147,7 @@ int ether_wake_main(int argc, char *argv[])
        {
                struct ifreq if_hwaddr;
 
-               strcpy(if_hwaddr.ifr_name, ifname);
+               strncpy(if_hwaddr.ifr_name, ifname, sizeof(if_hwaddr.ifr_name));
                if (ioctl(s, SIOCGIFHWADDR, &if_hwaddr) < 0)
                        bb_perror_msg_and_die("SIOCGIFHWADDR on %s failed", ifname);
 
@@ -223,8 +225,6 @@ static inline void get_dest_addr(const char *hostid, struct ether_addr *eaddr)
 #if !defined(__UCLIBC__)
        } else if (ether_hostton(hostid, eaddr) == 0) {
                bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr));
-#else
-# warning Need to implement ether_hostton() for uClibc
 #endif
        } else
                bb_show_usage();