From a971c561d1165cb79919fe966e7f2bd8dbbadcd6 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Wed, 9 Mar 2016 09:31:22 -0800 Subject: [PATCH] Close dbus connection if firewalld is not started Signed-off-by: Alexander Morozov --- libnetwork/iptables/firewalld.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libnetwork/iptables/firewalld.go b/libnetwork/iptables/firewalld.go index 246ce4d7a1..970931ce91 100644 --- a/libnetwork/iptables/firewalld.go +++ b/libnetwork/iptables/firewalld.go @@ -44,11 +44,15 @@ func FirewalldInit() error { if connection, err = newConnection(); err != nil { return fmt.Errorf("Failed to connect to D-Bus system bus: %v", err) } + firewalldRunning = checkRunning() + if !firewalldRunning { + connection.sysconn.Close() + connection = nil + } if connection != nil { go signalHandler() } - firewalldRunning = checkRunning() return nil }