From: Vinay Sajip Date: Tue, 9 Oct 2012 07:17:41 +0000 (+0100) Subject: Issue #16168: Use specified socket type for domain sockets in SysLogHandler. X-Git-Tag: v2.7.4rc1~500 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6ecdb581544698830b2623f1f9e2c2c9baacd219;p=thirdparty%2FPython%2Fcpython.git Issue #16168: Use specified socket type for domain sockets in SysLogHandler. --- diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 19a5f10ed1cd..dcb7fd20f961 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -764,18 +764,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 # curious: when talking to the unix-domain '/dev/log' socket, a # zero-terminator seems to be required. this string is placed