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

This commit is contained in:
Vinay Sajip 2012-06-25 23:17:07 +01:00
parent ea1eda2a29
commit c14bae47b8
1 changed files with 5 additions and 1 deletions

View File

@ -771,7 +771,11 @@ class SysLogHandler(logging.Handler):
except socket.error:
self.socket.close()
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
self.socket.connect(address)
except socket.error:
self.socket.close()
raise
# curious: when talking to the unix-domain '/dev/log' socket, a
# zero-terminator seems to be required. this string is placed