Kaydet (Commit) c14bae47 authored tarafından Vinay Sajip's avatar Vinay Sajip

Issue #15179: Closed socket on connection failure. Thanks to Kazutaka Morita for the patch.

üst ea1eda2a
...@@ -771,7 +771,11 @@ class SysLogHandler(logging.Handler): ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment