portmap: don't panic if listing a chain returns fewer lines than expected
This commit is contained in:
parent
75d3585862
commit
7d329215b0
@ -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