summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorrik <rik@FreeBSD.org>2008-09-20 15:54:22 +0000
committerrik <rik@FreeBSD.org>2008-09-20 15:54:22 +0000
commita32f707733c85820ecb4ee9dec2f248c602b2e34 (patch)
treee5d4e0e0369984e4b2876c070143ddf0f1a21411 /sbin
parent01d93d1030cce6c841e0878939c15f8dfd897e0e (diff)
downloadFreeBSD-src-a32f707733c85820ecb4ee9dec2f248c602b2e34.zip
FreeBSD-src-a32f707733c85820ecb4ee9dec2f248c602b2e34.tar.gz
Do not do the useless job for an empty table.
MFC after: 1 month
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ipfw/ipfw2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c
index 78d758f..fb13886 100644
--- a/sbin/ipfw/ipfw2.c
+++ b/sbin/ipfw/ipfw2.c
@@ -5937,6 +5937,11 @@ table_handler(int ac, char *av[])
l = sizeof(a);
if (do_cmd(IP_FW_TABLE_GETSIZE, &a, (uintptr_t)&l) < 0)
err(EX_OSERR, "getsockopt(IP_FW_TABLE_GETSIZE)");
+
+ /* If a is zero we have nothing to do, the table is empty. */
+ if (a == 0)
+ return;
+
l = sizeof(*tbl) + a * sizeof(ipfw_table_entry);
tbl = malloc(l);
if (tbl == NULL)
OpenPOWER on IntegriCloud