aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/ping
diff options
context:
space:
mode:
authorMariusz Zaborski <oshogbo@FreeBSD.org>2018-11-04 20:26:29 +0000
committerMariusz Zaborski <oshogbo@FreeBSD.org>2018-11-04 20:26:29 +0000
commitd68e2c047b8d17f5342e8787e3c41964f4111e2c (patch)
tree17539bb5fee82712eb3c5c8e682be7d0ce27075c /sbin/ping
parentd9c2248dd51cb38147b2fa9dc035b7bdff6881b8 (diff)
downloadsrc-d68e2c047b8d17f5342e8787e3c41964f4111e2c.tar.gz
src-d68e2c047b8d17f5342e8787e3c41964f4111e2c.zip
ping: simplify use of Casper
There is no need to check if capdns is NULL. If we will build the system without casper all cap_gethostaddr will be replaced by the standard functions.
Notes
Notes: svn path=/head/; revision=340143
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 492e21cbb8f9..81db0d5c24b4 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -566,11 +566,7 @@ main(int argc, char *const *argv)
if (inet_aton(source, &sock_in.sin_addr) != 0) {
shostname = source;
} else {
- if (capdns != NULL)
- hp = cap_gethostbyname2(capdns, source,
- AF_INET);
- else
- hp = gethostbyname2(source, AF_INET);
+ hp = cap_gethostbyname2(capdns, source, AF_INET);
if (!hp)
errx(EX_NOHOST, "cannot resolve %s: %s",
source, hstrerror(h_errno));
@@ -598,10 +594,7 @@ main(int argc, char *const *argv)
if (inet_aton(target, &to->sin_addr) != 0) {
hostname = target;
} else {
- if (capdns != NULL)
- hp = cap_gethostbyname2(capdns, target, AF_INET);
- else
- hp = gethostbyname2(target, AF_INET);
+ hp = cap_gethostbyname2(capdns, target, AF_INET);
if (!hp)
errx(EX_NOHOST, "cannot resolve %s: %s",
target, hstrerror(h_errno));
@@ -1693,10 +1686,7 @@ pr_addr(struct in_addr ina)
if (options & F_NUMERIC)
return inet_ntoa(ina);
- if (capdns != NULL)
- hp = cap_gethostbyaddr(capdns, (char *)&ina, 4, AF_INET);
- else
- hp = gethostbyaddr((char *)&ina, 4, AF_INET);
+ hp = cap_gethostbyaddr(capdns, (char *)&ina, 4, AF_INET);
if (hp == NULL)
return inet_ntoa(ina);