diff options
author | Adam Wolk <awolk@cvs.openbsd.org> | 2017-07-15 16:01:15 +0000 |
---|---|---|
committer | Adam Wolk <awolk@cvs.openbsd.org> | 2017-07-15 16:01:15 +0000 |
commit | 44298c6469668ed5908c2f92aaeb653bd03c34ce (patch) | |
tree | 1de4069f78dbdc4f0e2c975a68ae536b81ec15dd /sbin | |
parent | 9ad88af71d5ec604408f94a206c5c5e474c09db3 (diff) |
sbin/pfctl: void functions and exit(3) on error
Changes:
voided:
- pfctl_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@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pfctl/pfctl.h | 8 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_table.c | 17 |
2 files changed, 13 insertions, 12 deletions
diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index 38ea3f85843..4a276998eb7 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.h,v 1.53 2015/01/19 23:52:02 deraadt Exp $ */ +/* $OpenBSD: pfctl.h,v 1.54 2017/07/15 16:01:14 awolk Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -75,12 +75,12 @@ 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_clear_tables(const char *, int); -int pfctl_show_tables(const char *, int); +void pfctl_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); void warn_namespace_collision(const char *); -int pfctl_show_ifaces(const char *, int); +void pfctl_show_ifaces(const char *, int); FILE *pfctl_fopen(const char *, const char *); /* diff --git a/sbin/pfctl/pfctl_table.c b/sbin/pfctl/pfctl_table.c index 457dbfe5625..0e2f81d888e 100644 --- a/sbin/pfctl/pfctl_table.c +++ b/sbin/pfctl/pfctl_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_table.c,v 1.75 2017/04/13 07:30:21 jsg Exp $ */ +/* $OpenBSD: pfctl_table.c,v 1.76 2017/07/15 16:01:14 awolk Exp $ */ /* * Copyright (c) 2002 Cedric Berger @@ -102,16 +102,18 @@ static const char *istats_text[2][2][2] = { table.pfrt_flags &= ~PFR_TFLAG_PERSIST; \ } while(0) -int +void pfctl_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) == -1) + 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) == -1) + exit(1); } int @@ -594,7 +596,7 @@ xprintf(int opts, const char *fmt, ...) /* interface stuff */ -int +void pfctl_show_ifaces(const char *filter, int opts) { struct pfr_buffer b; @@ -608,7 +610,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; @@ -618,7 +620,6 @@ pfctl_show_ifaces(const char *filter, int opts) pfctl_print_title("INTERFACES:"); PFRB_FOREACH(p, &b) print_iface(p, opts); - return (0); } void |