ping6: fix uninitialized variable warnings when MK_CASPER=no

Submitted by:	Ján Sučan <sucanjan@gmail.com>
MFC after:	2 weeks
Sponsored by:	Google, inc. (Google Summer of Code 2019)
Differential Revision:	https://reviews.freebsd.org/D21273
This commit is contained in:
Alan Somers 2019-08-15 19:27:36 +00:00
parent 017455f13c
commit 8a3107c8f3

View File

@ -961,6 +961,7 @@ main(int argc, char *argv[])
} }
/* From now on we will use only reverse DNS lookups. */ /* From now on we will use only reverse DNS lookups. */
#ifdef WITH_CASPER
if (capdns != NULL) { if (capdns != NULL) {
const char *types[1]; const char *types[1];
@ -968,7 +969,7 @@ main(int argc, char *argv[])
if (cap_dns_type_limit(capdns, types, nitems(types)) < 0) if (cap_dns_type_limit(capdns, types, nitems(types)) < 0)
err(1, "unable to limit access to system.dns service"); err(1, "unable to limit access to system.dns service");
} }
#endif
if (!(options & F_SRCADDR)) { if (!(options & F_SRCADDR)) {
/* /*
* get the source address. XXX since we revoked the root * get the source address. XXX since we revoked the root
@ -2780,9 +2781,10 @@ static cap_channel_t *
capdns_setup(void) capdns_setup(void)
{ {
cap_channel_t *capcas, *capdnsloc; cap_channel_t *capcas, *capdnsloc;
#ifdef WITH_CASPER
const char *types[2]; const char *types[2];
int families[1]; int families[1];
#endif
capcas = cap_init(); capcas = cap_init();
if (capcas == NULL) if (capcas == NULL)
err(1, "unable to create casper process"); err(1, "unable to create casper process");
@ -2791,6 +2793,7 @@ capdns_setup(void)
cap_close(capcas); cap_close(capcas);
if (capdnsloc == NULL) if (capdnsloc == NULL)
err(1, "unable to open system.dns service"); err(1, "unable to open system.dns service");
#ifdef WITH_CASPER
types[0] = "NAME2ADDR"; types[0] = "NAME2ADDR";
types[1] = "ADDR2NAME"; types[1] = "ADDR2NAME";
if (cap_dns_type_limit(capdnsloc, types, nitems(types)) < 0) if (cap_dns_type_limit(capdnsloc, types, nitems(types)) < 0)
@ -2798,6 +2801,6 @@ capdns_setup(void)
families[0] = AF_INET6; families[0] = AF_INET6;
if (cap_dns_family_limit(capdnsloc, families, nitems(families)) < 0) if (cap_dns_family_limit(capdnsloc, families, nitems(families)) < 0)
err(1, "unable to limit access to system.dns service"); err(1, "unable to limit access to system.dns service");
#endif
return (capdnsloc); return (capdnsloc);
} }