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
This commit is contained in:
Ben Wilber 2024-05-09 20:08:15 -06:00 committed by Warner Losh
parent 12be6f12e8
commit 09025a7147
1 changed files with 3 additions and 2 deletions

View File

@ -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) {