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:
commit
35b87a34db
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user