diff options
author | Denis Vlasenko | 2007-01-25 19:44:38 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-01-25 19:44:38 +0000 |
commit | 90ec4dc0c71c6343e45469b3a3bfdd6403dd8de1 (patch) | |
tree | 6b577d9a4b26931daa5f24aa31bd1256aa39053b /networking/arping.c | |
parent | aeb4bdd582d6b11adcdb128d97076101c3c61f1d (diff) | |
download | busybox-90ec4dc0c71c6343e45469b3a3bfdd6403dd8de1.zip busybox-90ec4dc0c71c6343e45469b3a3bfdd6403dd8de1.tar.gz |
arping: stop using last gethostbyname2 in the tree
hostname: small optimization
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)) { |