arping: stop using last gethostbyname2 in the tree
hostname: small optimization
This commit is contained in:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user