瀏覽代碼

libnetwork/iptables: checkRunning(): use early return

Remove redundant variable declarations, and use an early return instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 年之前
父節點
當前提交
0921360133
共有 1 個文件被更改,包括 5 次插入7 次删除
  1. 5 7
      libnetwork/iptables/firewalld.go

+ 5 - 7
libnetwork/iptables/firewalld.go

@@ -177,14 +177,12 @@ func OnReloaded(callback func()) {
 
 // Call some remote method to see whether the service is actually running.
 func checkRunning() bool {
-	var zone string
-	var err error
-
-	if connection != nil {
-		err = connection.sysObj.Call(dbusInterface+".getDefaultZone", 0).Store(&zone)
-		return err == nil
+	if connection == nil {
+		return false
 	}
-	return false
+	var zone string
+	err := connection.sysObj.Call(dbusInterface+".getDefaultZone", 0).Store(&zone)
+	return err == nil
 }
 
 // Passthrough method simply passes args through to iptables/ip6tables