Merge pull request #191 from dcbw/portmap-panic-fix

portmap: don't panic if listing a chain returns fewer lines than exected
This commit is contained in:
Dan Williams 2018-09-05 10:09:02 -05:00 committed by GitHub
commit 35b87a34db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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