From b5ca932be26a1762b9db78b29f2946fd9ae3c2d4 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Tue, 9 Oct 2012 08:19:25 +0100 Subject: [PATCH] Issue #16168: Use specified socket type for domain sockets in SysLogHandler. --- Lib/logging/handlers.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index d4df5c6d61d..2e29f92b704 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -754,18 +754,12 @@ class SysLogHandler(logging.Handler): self.formatter = None def _connect_unixsocket(self, address): - self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM) - # syslog may require either DGRAM or STREAM sockets + self.socket = socket.socket(socket.AF_UNIX, self.socktype) try: self.socket.connect(address) 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 + raise def encodePriority(self, facility, priority): """