diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index d14c9e92ed7c..5b0dd95a812a 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -225,18 +225,30 @@ ipfw_table_handler(int ac, char *av[]) table_modify(&oh, ac, av); break; case TOK_DESTROY: - if (table_destroy(&oh) != 0) + if (table_destroy(&oh) == 0) + break; + if (errno != ESRCH) err(EX_OSERR, "failed to destroy table %s", tablename); + /* ESRCH isn't fatal, warn if not quiet mode */ + if (co.do_quiet == 0) + warn("failed to destroy table %s", tablename); break; case TOK_FLUSH: if (is_all == 0) { - if ((error = table_flush(&oh)) != 0) + if ((error = table_flush(&oh)) == 0) + break; + if (errno != ESRCH) err(EX_OSERR, "failed to flush table %s info", tablename); + /* ESRCH isn't fatal, warn if not quiet mode */ + if (co.do_quiet == 0) + warn("failed to flush table %s info", + tablename); } else { error = tables_foreach(table_flush_one, &oh, 1); if (error != 0) err(EX_OSERR, "failed to flush tables list"); + /* XXX: we ignore errors here */ } break; case TOK_SWAP: @@ -593,14 +605,14 @@ table_do_swap(ipfw_obj_header *oh, char *second) static int table_swap(ipfw_obj_header *oh, char *second) { - int error; if (table_check_name(second) != 0) errx(EX_USAGE, "table name %s is invalid", second); - error = table_do_swap(oh, second); + if (table_do_swap(oh, second) == 0) + return (0); - switch (error) { + switch (errno) { case EINVAL: errx(EX_USAGE, "Unable to swap table: check types"); case EFBIG: