diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-06-25 22:18:45 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-06-25 22:18:45 (GMT) |
commit | 3e6d71d3360f2b8dd0232b492d0a63cc6b5419d3 (patch) | |
tree | d8bb5356cc345ec54e71b3e6171625e0aeba13a2 /Lib/logging/handlers.py | |
parent | 1dd75a64aaf8d69e851b125751deaa446de4eef1 (diff) | |
download | cpython-3e6d71d3360f2b8dd0232b492d0a63cc6b5419d3.zip cpython-3e6d71d3360f2b8dd0232b492d0a63cc6b5419d3.tar.gz cpython-3e6d71d3360f2b8dd0232b492d0a63cc6b5419d3.tar.bz2 |
Issue #15179: Closed socket on connection failure. Thanks to Kazutaka Morita for the patch.
Diffstat (limited to 'Lib/logging/handlers.py')
-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 22f8c34..d4df5c6 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -761,7 +761,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 def encodePriority(self, facility, priority): """ |