diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-21 23:48:38 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-21 23:48:38 +0000 |
commit | a771e7c0057d0f506f8cdf67be39268e1c9f0735 (patch) | |
tree | bef7afb1304b3510d4857148a50e162a0578c363 /networking/arping.c | |
parent | e6b10ef0a7a5761c4cd0fe5f48bad953aa92240e (diff) |
*: remove check for errors on getsockaddr in cases we know they can't happen
libbb: make get_sock_lsa use only one getsockaddr syscall, not two
function old new delta
get_sock_lsa 72 101 +29
do_iplink 1151 1137 -14
arping_main 1585 1569 -16
dolisten 789 755 -34
xrtnl_open 161 94 -67
Diffstat (limited to 'networking/arping.c')
-rw-r--r-- | networking/arping.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/networking/arping.c b/networking/arping.c index 915af3261..ab39c717b 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -348,9 +348,10 @@ int arping_main(int argc UNUSED_PARAM, char **argv) if (setsockopt(probe_fd, SOL_SOCKET, SO_DONTROUTE, &const_int_1, sizeof(const_int_1)) == -1) bb_perror_msg("setsockopt(SO_DONTROUTE)"); xconnect(probe_fd, (struct sockaddr *) &saddr, sizeof(saddr)); - if (getsockname(probe_fd, (struct sockaddr *) &saddr, &alen) == -1) { - bb_perror_msg_and_die("getsockname"); - } + getsockname(probe_fd, (struct sockaddr *) &saddr, &alen); + //never happens: + //if (getsockname(probe_fd, (struct sockaddr *) &saddr, &alen) == -1) + // bb_perror_msg_and_die("getsockname"); if (saddr.sin_family != AF_INET) bb_error_msg_and_die("no IP address configured"); src = saddr.sin_addr; @@ -365,10 +366,10 @@ int arping_main(int argc UNUSED_PARAM, char **argv) { socklen_t alen = sizeof(me); - - if (getsockname(sock_fd, (struct sockaddr *) &me, &alen) == -1) { - bb_perror_msg_and_die("getsockname"); - } + getsockname(sock_fd, (struct sockaddr *) &me, &alen); + //never happens: + //if (getsockname(sock_fd, (struct sockaddr *) &me, &alen) == -1) + // bb_perror_msg_and_die("getsockname"); } if (me.sll_halen == 0) { bb_error_msg(err_str, "is not ARPable (no ll address)"); |