Skip to content

Commit b5ca932

Browse files
committed
Issue #16168: Use specified socket type for domain sockets in SysLogHandler.
1 parent 470ee39 commit b5ca932

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Lib/logging/handlers.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -754,18 +754,12 @@ def __init__(self, address=('localhost', SYSLOG_UDP_PORT),
754754
self.formatter = None
755755

756756
def _connect_unixsocket(self, address):
757-
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
758-
# syslog may require either DGRAM or STREAM sockets
757+
self.socket = socket.socket(socket.AF_UNIX, self.socktype)
759758
try:
760759
self.socket.connect(address)
761760
except socket.error:
762761
self.socket.close()
763-
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
764-
try:
765-
self.socket.connect(address)
766-
except socket.error:
767-
self.socket.close()
768-
raise
762+
raise
769763

770764
def encodePriority(self, facility, priority):
771765
"""

0 commit comments

Comments
 (0)