From 02ded71c1cad62b5717a2f998f0f3288f8f48622 Mon Sep 17 00:00:00 2001 From: Aaron Lipinski Date: Sun, 4 Apr 2021 10:19:29 +1200 Subject: [PATCH] accept only value used in structure --- ui/dns.c | 10 +++++----- ui/dns.h | 2 +- ui/mtr.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/dns.c b/ui/dns.c index a38113b..94af8b7 100644 --- a/ui/dns.c +++ b/ui/dns.c @@ -124,7 +124,7 @@ static void set_sockaddr_ip( } void dns_open( - struct mtr_ctl *ctl) + sa_family_t family) { int pid; @@ -173,16 +173,16 @@ void dns_open( buf[strlen(buf) - 1] = 0; /* chomp newline. */ - longipstr(buf, &host, ctl->af); - set_sockaddr_ip(ctl->af, &sa, &host); - salen = (ctl->af == AF_INET) ? sizeof(struct sockaddr_in) : + longipstr(buf, &host, family); + set_sockaddr_ip(family, &sa, &host); + salen = (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); rv = getnameinfo((struct sockaddr *) &sa, salen, hostname, sizeof(hostname), NULL, 0, 0); if (rv == 0) { snprintf(result, sizeof(result), - "%s %s\n", strlongip(ctl->af, &host), hostname); + "%s %s\n", strlongip(family, &host), hostname); rv = write(fromdns[1], result, strlen(result)); if (rv < 0) diff --git a/ui/dns.h b/ui/dns.h index 6668335..b15d6ad 100644 --- a/ui/dns.h +++ b/ui/dns.h @@ -23,7 +23,7 @@ /* Prototypes for dns.c */ extern void dns_open( - struct mtr_ctl *ctl); + sa_family_t family); extern int dns_waitfd( void); extern void dns_ack( diff --git a/ui/mtr.c b/ui/mtr.c index b33a136..b959919 100644 --- a/ui/mtr.c +++ b/ui/mtr.c @@ -858,7 +858,7 @@ int main( } lock(stdout); - dns_open(&ctl); + dns_open(ctl.af); display_open(&ctl); display_loop(&ctl); -- 2.47.2