mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-26 16:16:31 -06:00
Fix used before assignment bug in host_port_open()
Detected by most recent pylint under Python 3.5. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
parent
fb7c111ac1
commit
deaad95247
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user