Skip to content

Commit 3f301b2

Browse files
committed
support/unix_connect: improve Unix socket support
Use an abstract address if no matching filesystem path is found.
1 parent 3ab64bf commit 3f301b2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Xlib/support/unix_connect.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,12 @@ def get_socket(dname, host, dno):
8686

8787
# Else use Unix socket
8888
else:
89+
address = '/tmp/.X11-unix/X%d' % dno
90+
if not os.path.exists(address):
91+
# Use abstract address.
92+
address = '\0' + address
8993
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
90-
s.connect('/tmp/.X11-unix/X%d' % dno)
94+
s.connect(address)
9195
except socket.error as val:
9296
raise error.DisplayConnectionError(dname, str(val))
9397

0 commit comments

Comments
 (0)