diff options
author | Roman Kurakin <rik@FreeBSD.org> | 2008-09-20 15:54:22 +0000 |
---|---|---|
committer | Roman Kurakin <rik@FreeBSD.org> | 2008-09-20 15:54:22 +0000 |
commit | 03d4b38d9e8dcd0edee06227bcc2da02f9fad3e6 (patch) | |
tree | e5d4e0e0369984e4b2876c070143ddf0f1a21411 /sbin/ipfw | |
parent | 3aeb70f799547d7e3842b3da5a9c4e59697b67dc (diff) | |
download | src-03d4b38d9e8dcd0edee06227bcc2da02f9fad3e6.tar.gz src-03d4b38d9e8dcd0edee06227bcc2da02f9fad3e6.zip |
Do not do the useless job for an empty table.
MFC after: 1 month
Notes
Notes:
svn path=/head/; revision=183205
Diffstat (limited to 'sbin/ipfw')
-rw-r--r-- | sbin/ipfw/ipfw2.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 78d758f0bd8d..fb13886f4d17 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) |