diff options
author | 2003-01-23 16:10:29 +0000 | |
---|---|---|
committer | 2003-01-23 16:10:29 +0000 | |
commit | 22d4dcb160f0efc4d6489acf720dbd7308dbc96c (patch) | |
tree | bf91c499c4c8bbe80154bb105be4511fa1ae62f0 | |
parent | 'conjunction' typos (diff) | |
download | wireguard-openbsd-22d4dcb160f0efc4d6489acf720dbd7308dbc96c.tar.xz wireguard-openbsd-22d4dcb160f0efc4d6489acf720dbd7308dbc96c.zip |
Little cleanup thanks to Andrey Matveev
-rw-r--r-- | sbin/pfctl/pfctl_table.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index 888ba0213a2..29a1319967b 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_table.c,v 1.25 2003/01/22 01:15:32 cedric Exp $ */ +/* $OpenBSD: pfctl_table.c,v 1.26 2003/01/23 16:10:29 cedric Exp $ */ /* * Copyright (c) 2002 Cedric Berger @@ -513,21 +513,21 @@ print_addrx(struct pfr_addr *ad, struct pfr_addr *rad, int dns) if (rad != NULL && fback == PFR_FB_NONE) printf("\t nomatch"); if (dns && ad->pfra_net == hostnet) { - char host[NI_MAXHOST] = "?"; + char host[NI_MAXHOST]; union sockaddr_union sa; - int rv; + strlcpy(host, "?", sizeof(host)); bzero(&sa, sizeof(sa)); - sa.sa.sa_len = (ad->pfra_af == AF_INET) ? - sizeof(sa.sin) : sizeof(sa.sin6); sa.sa.sa_family = ad->pfra_af; - if (ad->pfra_af == AF_INET) + if (sa.sa.sa_family == AF_INET) { + sa.sa.sa_len = sizeof(sa.sin); sa.sin.sin_addr = ad->pfra_ip4addr; - else + } else { + sa.sa.sa_len = sizeof(sa.sin6); sa.sin6.sin6_addr = ad->pfra_ip6addr; - rv = getnameinfo(&sa.sa, sa.sa.sa_len, host, sizeof(host), - NULL, 0, NI_NAMEREQD); - if (!rv) + } + if (getnameinfo(&sa.sa, sa.sa.sa_len, host, sizeof(host), + NULL, 0, NI_NAMEREQD) == 0) printf("\t(%s)", host); } printf("\n"); |