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;
{
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);
/* This is necessary for broadcasts to work */
if (flags /*& 1 [OPT_BROADCAST]*/) {
- int one = 1;
- if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, (void *)&one, sizeof(one)) < 0)
+ if (setsockopt_broadcast(s) < 0)
bb_perror_msg("SO_BROADCAST");
}
#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();