소스 검색

libnetwork/iptables: IPTable.ExistChain(): remove redundant if/else

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 년 전
부모
커밋
c74a083672
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      libnetwork/iptables/iptables.go

+ 2 - 4
libnetwork/iptables/iptables.go

@@ -554,10 +554,8 @@ func (iptable IPTable) RawCombinedOutputNative(args ...string) error {
 
 
 // ExistChain checks if a chain exists
 // ExistChain checks if a chain exists
 func (iptable IPTable) ExistChain(chain string, table Table) bool {
 func (iptable IPTable) ExistChain(chain string, table Table) bool {
-	if _, err := iptable.Raw("-t", string(table), "-nL", chain); err == nil {
-		return true
-	}
-	return false
+	_, err := iptable.Raw("-t", string(table), "-nL", chain)
+	return err == nil
 }
 }
 
 
 // SetDefaultPolicy sets the passed default policy for the table/chain
 // SetDefaultPolicy sets the passed default policy for the table/chain