[PATCH xinit 2/2] startx: Make startx auto display select work with per user /tmp dirs

Hans de Goede hdegoede at redhat.com
Fri Mar 20 07:02:36 PDT 2015


If a separate /tmp per user is used the existing auto display select code
does not work, add an extra check for the unix socket for the display number
existing in /proc/net/unix (linux only).

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 startx.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/startx.cpp b/startx.cpp
index fe49996..3b0dd86 100644
--- a/startx.cpp
+++ b/startx.cpp
@@ -120,7 +120,11 @@ enable_xauth=1
 XCOMM Automatically determine an unused $DISPLAY
 d=0
 while true ; do
-    [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] || break
+    [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] ||
+#ifdef __linux__
+        grep -q "/tmp/.X11-unix/X$d" "/proc/net/unix" ||
+#endif
+        break
     d=$(($d + 1))
 done
 defaultdisplay=":$d"
-- 
2.3.3



More information about the xorg-devel mailing list