From 9826eae9f091d461bd117c254ba8e255dd084797 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 2 Feb 2018 16:35:26 +0100
Subject: [PATCH] wayland: Do not fail on stalled .X11-unix entries

If for whatever reason, there are stalled files in /tmp/.X11-unix/ the
bind() to the abstract socket will succeed but not the bind() to the
to the UNIX socket.

This causes gnome-shell/mutter to fail because it cannot start Xwayland
(while it could actually, by using a different display).

In case of failure to bind to the UNIX socket, try the next display
instead of failing, to avoid stalled entries in /tmp/.X11-unix.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/13
---
 src/wayland/meta-xwayland.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 50cfc7c57..ce21fe5ee 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -458,7 +458,8 @@ choose_xdisplay (MetaXWaylandManager *manager)
         {
           unlink (lock_file);
           close (manager->abstract_fd);
-          return FALSE;
+          display++;
+          continue;
         }
 
       break;
-- 
2.14.3

