git: 09025a714708 - main - ipfw: correctly report table manipulation errors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 May 2024 02:09:48 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=09025a7147084783bf1dd4d1bec463ceab8d16b4 commit 09025a7147084783bf1dd4d1bec463ceab8d16b4 Author: Ben Wilber <ben@desync.com> AuthorDate: 2024-05-10 02:08:15 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-05-10 02:08:18 +0000 ipfw: correctly report table manipulation errors Let ipfw(8) report the actual error instead of the error that may have come from calling printf(). Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1221 --- sbin/ipfw/tables.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index 7901950acadd..4c783e02f856 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -1037,6 +1037,9 @@ table_modify_record(ipfw_obj_header *oh, int ac, char *av[], int add, } } + /* Get real OS error */ + error = errno; + /* Report results back */ ptent = tent_buf; for (i = 0; i < count; ptent++, i++) { @@ -1089,8 +1092,6 @@ table_modify_record(ipfw_obj_header *oh, int ac, char *av[], int add, if (error == 0) return; - /* Get real OS error */ - error = errno; /* Try to provide more human-readable error */ switch (error) {