diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 59783592a370..ac60a924c228 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -2009,7 +2009,7 @@ pfctl_get_states_h(struct pfctl_handle *h, struct pfctl_state_filter *filter, pf return (ret); } - return (0); + return (e.error); } int diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index e84e7f9272d4..f35baf25ec35 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1991,6 +1991,7 @@ pfctl_show_states(int dev, const char *iface, int opts) { struct pfctl_show_state_arg arg; struct pfctl_state_filter filter = {}; + int ret; if (iface != NULL) strlcpy(filter.ifname, iface, IFNAMSIZ); @@ -1999,8 +2000,8 @@ pfctl_show_states(int dev, const char *iface, int opts) arg.dotitle = opts & PF_OPT_SHOWALL; arg.iface = iface; - if (pfctl_get_states_h(pfh, &filter, pfctl_show_state, &arg)) - return (-1); + if ((ret = pfctl_get_states_h(pfh, &filter, pfctl_show_state, &arg)) != 0) + errc(1, ret, "pfctl_get_states"); return (0); }