summaryrefslogtreecommitdiffstats
path: root/ipapython/ipautil.py
diff options
context:
space:
mode:
Diffstat (limited to 'ipapython/ipautil.py')
-rw-r--r--ipapython/ipautil.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index 408ca3fb0..e3e4611b8 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -941,6 +941,7 @@ def host_port_open(host, port, socket_type=socket.SOCK_STREAM,
# port has to be open on ALL resolved IPs
for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket_type):
af, socktype, proto, _canonname, sa = res
+ s = None
try:
s = socket.socket(af, socktype, proto)
@@ -968,9 +969,8 @@ def host_port_open(host, port, socket_type=socket.SOCK_STREAM,
else:
root_logger.error(msg)
finally:
- if s:
+ if s is not None:
s.close()
- s = None
return port_open