Browse Source

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

pull/2332/head
Vinay Sajip 14 years ago
parent
commit
c14bae47b8
  1. 6
      Lib/logging/handlers.py

6
Lib/logging/handlers.py

@ -771,7 +771,11 @@ class SysLogHandler(logging.Handler):
except socket.error:
self.socket.close()
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
# zero-terminator seems to be required. this string is placed

Loading…
Cancel
Save