]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #16168: Use specified socket type for domain sockets in SysLogHandler.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 9 Oct 2012 07:19:25 +0000 (08:19 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 9 Oct 2012 07:19:25 +0000 (08:19 +0100)
Lib/logging/handlers.py

index d4df5c6d61d5930367d6ecf06ae89dd0b24395f5..2e29f92b7044cd301556850d8e3d2fd8aa82ee48 100644 (file)
@@ -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):
         """