diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-06-25 22:17:07 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-06-25 22:17:07 (GMT) |
commit | c14bae47b805ab518140fc36bf95e86b1df114aa (patch) | |
tree | bd94153f0c7bc0a690a35d5fa508176952fb032d /Lib | |
parent | ea1eda2a2984e0dd9e0b0311bb8a6766856547a4 (diff) | |
download | cpython-c14bae47b805ab518140fc36bf95e86b1df114aa.zip cpython-c14bae47b805ab518140fc36bf95e86b1df114aa.tar.gz cpython-c14bae47b805ab518140fc36bf95e86b1df114aa.tar.bz2 |
Issue #15179: Closed socket on connection failure. Thanks to Kazutaka Morita for the patch.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/logging/handlers.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 5af73e9..19a5f10 100644 --- a/Lib/logging/handlers.py +++ b/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 |