* Advert also sets unsolicited.
*/
opt_complementary = "=1:Df:AU";
- opt = getopt32(argc, argv, "DUAqfbc:w:I:s:",
+ opt = getopt32(argv, "DUAqfbc:w:I:s:",
&str_count, &str_timeout, &device, &source);
if (opt & 0x40) /* -c: count */
count = xatou(str_count);
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, device, IFNAMSIZ - 1);
- if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0) {
- bb_error_msg_and_die("interface %s not found", device);
- }
+ ioctl_or_perror_and_die(sock, SIOCGIFINDEX, &ifr, "interface %s not found", device);
ifindex = ifr.ifr_ifindex;
- if (ioctl(sock, SIOCGIFFLAGS, (char *) &ifr)) {
- bb_error_msg_and_die("SIOCGIFFLAGS");
- }
+ xioctl(sock, SIOCGIFFLAGS, (char *) &ifr);
+
if (!(ifr.ifr_flags & IFF_UP)) {
bb_error_msg_and_die("interface %s is down", device);
}