diff options
Diffstat (limited to 'networking/arping.c')
-rw-r--r-- | networking/arping.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/networking/arping.c b/networking/arping.c index 55b2787..725b0e4 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -305,13 +305,11 @@ int arping_main(int argc, char **argv) } if (!inet_aton(target, &dst)) { - struct hostent *hp; - - hp = gethostbyname2(target, AF_INET); - if (!hp) { - bb_error_msg_and_die("invalid or unknown target %s", target); - } - memcpy(&dst, hp->h_addr, 4); + len_and_sockaddr *lsa; + lsa = host_and_af2sockaddr(target, 0, AF_INET); + memcpy(&dst, &lsa->sin.sin_addr.s_addr, 4); + if (ENABLE_FEATURE_CLEAN_UP) + free(lsa); } if (source && !inet_aton(source, &src)) { |