summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Berger <cedric@cvs.openbsd.org>2003-01-23 16:10:30 +0000
committerCedric Berger <cedric@cvs.openbsd.org>2003-01-23 16:10:30 +0000
commit801bfd9040965bc0a64170de4d7d32433015aa50 (patch)
treea70571bb52d8e3551cd585e44372f672432bc128
parent952acb5dc3d6ddd91ed418bd7233aeaa1e5e3f38 (diff)
Little cleanup thanks to Andrey Matveev
-rw-r--r--sbin/pfctl/pfctl_table.c20
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");