portmap: don't panic if listing a chain returns fewer lines than expected

This commit is contained in:
Dan Williams 2018-08-16 09:50:28 -05:00
parent 75d3585862
commit 7d329215b0

View File

@ -78,7 +78,7 @@ func (c *chain) teardown(ipt *iptables.IPTables) error {
for _, entryChain := range c.entryChains { for _, entryChain := range c.entryChains {
entryChainRules, err := ipt.List(c.table, entryChain) entryChainRules, err := ipt.List(c.table, entryChain)
if err != nil { if err != nil || len(entryChainRules) < 1 {
// Swallow error here - probably the chain doesn't exist. // Swallow error here - probably the chain doesn't exist.
// If we miss something the deletion will fail // If we miss something the deletion will fail
continue continue