diff options
-rw-r--r-- | sbin/pfctl/pfctl.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 5e00c7c4dae..e01087586c7 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.381 2020/01/15 22:38:31 kn Exp $ */ +/* $OpenBSD: pfctl.c,v 1.382 2020/01/16 01:02:20 kn Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -967,13 +967,8 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, memset(&prs, 0, sizeof(prs)); memcpy(prs.path, npath, sizeof(prs.path)); - if (ioctl(dev, DIOCGETRULESETS, &prs) == -1) { - if (errno == EINVAL) - fprintf(stderr, "Anchor '%s' " - "not found.\n", anchorname); - else - err(1, "DIOCGETRULESETS"); - } + if (ioctl(dev, DIOCGETRULESETS, &prs) == -1) + errx(1, "%s", pf_strerror(errno)); mnr = prs.nr; for (nr = 0; nr < mnr; ++nr) { @@ -2206,13 +2201,8 @@ pfctl_walk_anchors(int dev, int opts, const char *anchor, memset(&pr, 0, sizeof(pr)); strlcpy(pr.path, anchor, sizeof(pr.path)); - if (ioctl(dev, DIOCGETRULESETS, &pr) == -1) { - if (errno == EINVAL) - fprintf(stderr, "Anchor '%s' not found.\n", anchor); - else - err(1, "DIOCGETRULESETS"); - return (-1); - } + if (ioctl(dev, DIOCGETRULESETS, &pr) == -1) + errx(1, "%s", pf_strerror(errno)); mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { char sub[PATH_MAX]; |