View | Details | Raw Unified | Return to bug 253277
Collapse All | Expand All

(-)x11/xtrans/files/patch-no_unix_socket_unlink_before_bind-Xtranssock.c (+20 lines)
Line 0 Link Here
1
Don't unlink an existing socket before binding.
2
3
Sockets are normally cleaned up by the X server. Running the server as root
4
makes the unlink operation always succeed, as well as the subsequent socket
5
binding (creation in the file system). But success in binding a new socket is
6
used to detect in-use displays when using -displayfd. So, when running as root,
7
:0 is never detected as been used and its socket is systematically crushed,
8
rendering the existing :0 session stale.
9
10
--- Xtranssock.c	2019-03-16 22:30:31.000000000 +0100
11
+++ Xtranssock.c	2021-02-04 16:30:09.853117000 +0100
12
@@ -1004,8 +1004,6 @@
13
 	sockname.sun_path[0] = '\0';
14
 	namelen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&sockname.sun_path[1]);
15
     }
16
-    else
17
-	unlink (sockname.sun_path);
18
 
19
     if ((status = TRANS(SocketCreateListener) (ciptr,
20
 	(struct sockaddr *) &sockname, namelen, flags)) < 0)

Return to bug 253277