The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=feac17714fdf23d8cda5c552d6edd8e12ff9a43f

commit feac17714fdf23d8cda5c552d6edd8e12ff9a43f
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2025-05-29 12:28:54 +0000
Commit:     Kristof Provost <k...@freebsd.org>
CommitDate: 2025-06-06 12:59:47 +0000

    pfctl: void functions and exit(3) on error
    
    Changes:
     voided:
      - pfctl_do_clear_tables
      - pfctl_show_tables
      - pfctl_show_ifaces
    
    Those functions now exit(3) in case of error instead
    of passing it up to the callers (where it was ignored).
    
    OK mikeb@, sashan@
    
    Obtained from:  OpenBSD, awolk <aw...@openbsd.org>, c5e9690e42
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sbin/pfctl/pfctl.h       |  6 +++---
 sbin/pfctl/pfctl_table.c | 15 ++++++++-------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h
index b4f8c97854d1..7df56499ea16 100644
--- a/sbin/pfctl/pfctl.h
+++ b/sbin/pfctl/pfctl.h
@@ -81,13 +81,13 @@ int  pfi_get_ifaces(const char *, struct pfi_kif *, int *);
 int     pfi_clr_istats(const char *, int *, int);
 
 void    pfctl_print_title(char *);
-int     pfctl_do_clear_tables(const char *, int);
-int     pfctl_show_tables(const char *, int);
+void    pfctl_do_clear_tables(const char *, int);
+void    pfctl_show_tables(const char *, int);
 int     pfctl_command_tables(int, char *[], char *, const char *, char *,
            const char *, int);
 int     pfctl_show_altq(int, const char *, int, int);
 void    warn_namespace_collision(const char *);
-int     pfctl_show_ifaces(const char *, int);
+void    pfctl_show_ifaces(const char *, int);
 void   pfctl_show_creators(int);
 FILE   *pfctl_fopen(const char *, const char *);
 
diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c
index 834f74811ea2..f23a62f518e1 100644
--- a/sbin/pfctl/pfctl_table.c
+++ b/sbin/pfctl/pfctl_table.c
@@ -104,16 +104,18 @@ static const char *istats_text[2][2][2] = {
                table.pfrt_flags &= ~PFR_TFLAG_PERSIST;                 \
        } while(0)
 
-int
+void
 pfctl_do_clear_tables(const char *anchor, int opts)
 {
-       return pfctl_table(0, NULL, NULL, "-F", NULL, anchor, opts);
+       if (pfctl_table(0, NULL, NULL, "-F", NULL, anchor, opts))
+               exit(1);
 }
 
-int
+void
 pfctl_show_tables(const char *anchor, int opts)
 {
-       return pfctl_table(0, NULL, NULL, "-s", NULL, anchor, opts);
+       if (pfctl_table(0, NULL, NULL, "-s", NULL, anchor, opts))
+               exit(1);
 }
 
 int
@@ -644,7 +646,7 @@ xprintf(int opts, const char *fmt, ...)
 
 /* interface stuff */
 
-int
+void
 pfctl_show_ifaces(const char *filter, int opts)
 {
        struct pfr_buffer        b;
@@ -657,7 +659,7 @@ pfctl_show_ifaces(const char *filter, int opts)
                b.pfrb_size = b.pfrb_msize;
                if (pfi_get_ifaces(filter, b.pfrb_caddr, &b.pfrb_size)) {
                        radix_perror();
-                       return (1);
+                       exit(1);
                }
                if (b.pfrb_size <= b.pfrb_msize)
                        break;
@@ -666,7 +668,6 @@ pfctl_show_ifaces(const char *filter, int opts)
                pfctl_print_title("INTERFACES:");
        PFRB_FOREACH(p, &b)
                print_iface(p, opts);
-       return (0);
 }
 
 void

Reply via email to