diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index 1480911dc..99d0ef55d 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #if defined(HAVE_SYS_RANDOM) #include @@ -417,6 +419,23 @@ meta_xwayland_override_display_number (int number) display_number_override = number; } +static gboolean +ensure_x11_unix_dir (GError **error) +{ + if (mkdir ("/tmp/.X11-unix", 01777) != 0) + { + if (errno == EEXIST) + return TRUE; + + g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno), + "Failed to create directory \"/tmp/.X11-unix\": %s", + g_strerror (errno)); + return FALSE; + } + + return TRUE; +} + static gboolean open_display_sockets (MetaXWaylandManager *manager, int display_index, @@ -425,6 +444,9 @@ open_display_sockets (MetaXWaylandManager *manager, { int unix_fd; + if (!ensure_x11_unix_dir (error)) + return FALSE; + unix_fd = bind_to_unix_socket (display_index, error); if (unix_fd < 0) return FALSE;