[mutter/gnome-3-36] xwayland: Make sure /tmp/.X11-unix/ exists
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-36] xwayland: Make sure /tmp/.X11-unix/ exists
- Date: Thu, 18 Mar 2021 17:31:17 +0000 (UTC)
commit 19c0066b237ff018e7e0f434ee32f87a39723e0a
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Dec 9 15:04:56 2020 +0100
xwayland: Make sure /tmp/.X11-unix/ exists
When we're running under a polyinstantiated SELinux environment, we'll
likely start with an isolated and empty /tmp, meannig no /tmp/.X11-unix
directory to add things to. To make it possible to still function in
this kind of setup, make sure said directory exists.
(cherry picked from commit 357f3250cbc09c9b4c4064fa2bccfbc9a076a7c8)
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1789>
src/wayland/meta-xwayland.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index ac55599d4d..188b3b0f9b 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -30,6 +30,7 @@
#include <glib-unix.h>
#include <glib.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/un.h>
#if defined(HAVE_SYS_RANDOM)
#include <sys/random.h>
@@ -406,10 +407,28 @@ open_display_sockets (MetaXWaylandManager *manager,
return TRUE;
}
+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
choose_xdisplay (MetaXWaylandManager *manager,
MetaXWaylandConnection *connection)
{
+ g_autoptr (GError) error = NULL;
int display = 0;
char *lock_file = NULL;
gboolean fatal = FALSE;
@@ -419,6 +438,13 @@ choose_xdisplay (MetaXWaylandManager *manager,
else if (g_getenv ("RUNNING_UNDER_GDM"))
display = 1024;
+ if (!ensure_x11_unix_dir (&error))
+ {
+ g_warning ("Failed to ensure X11 socket directory: %s",
+ error->message);
+ return FALSE;
+ }
+
do
{
lock_file = create_lock_file (display, &display);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]