Date: Sun, 4 Nov 2018 20:26:29 +0000 (UTC) From: Mariusz Zaborski <oshogbo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340143 - head/sbin/ping Message-ID: <201811042026.wA4KQToh047020@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: oshogbo Date: Sun Nov 4 20:26:29 2018 New Revision: 340143 URL: https://svnweb.freebsd.org/changeset/base/340143 Log: 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. Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Sun Nov 4 19:43:59 2018 (r340142) +++ head/sbin/ping/ping.c Sun Nov 4 20:26:29 2018 (r340143) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811042026.wA4KQToh047020>