diff options
Diffstat (limited to 'networking/arping.c')
-rw-r--r-- | networking/arping.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/networking/arping.c b/networking/arping.c index 7a9fbc2..8e457b1 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -273,14 +273,11 @@ int arping_main(int argc, char **argv) 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); } |