mirror of https://github.com/python/cpython
Issue #15179: Closed socket on connection failure. Thanks to Kazutaka Morita for the patch.
This commit is contained in:
parent
ea1eda2a29
commit
c14bae47b8
|
@ -771,7 +771,11 @@ class SysLogHandler(logging.Handler):
|
||||||
except socket.error:
|
except socket.error:
|
||||||
self.socket.close()
|
self.socket.close()
|
||||||
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
self.socket.connect(address)
|
try:
|
||||||
|
self.socket.connect(address)
|
||||||
|
except socket.error:
|
||||||
|
self.socket.close()
|
||||||
|
raise
|
||||||
|
|
||||||
# curious: when talking to the unix-domain '/dev/log' socket, a
|
# curious: when talking to the unix-domain '/dev/log' socket, a
|
||||||
# zero-terminator seems to be required. this string is placed
|
# zero-terminator seems to be required. this string is placed
|
||||||
|
|
Loading…
Reference in New Issue