|
|
1443a4 |
From 56c2e4efdcef14531dcf752e89117d22a21ec8ad Mon Sep 17 00:00:00 2001
|
|
|
ae8d13 |
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
|
|
|
ae8d13 |
Date: Wed, 9 Dec 2020 15:18:29 +0100
|
|
|
ae8d13 |
Subject: [PATCH 2/2] xwayland: Make sure /tmp/.X11-unix/ exists
|
|
|
ae8d13 |
|
|
|
ae8d13 |
When we're running under a polyinstantiated SELinux environment, we'll
|
|
|
ae8d13 |
likely start with an isolated and empty /tmp, meannig no /tmp/.X11-unix
|
|
|
ae8d13 |
directory to add things to. To make it possible to still function in
|
|
|
ae8d13 |
this kind of setup, make sure said directory exists.
|
|
|
ae8d13 |
---
|
|
|
1443a4 |
src/wayland/meta-xwayland.c | 30 ++++++++++++++++++++++++++++--
|
|
|
1443a4 |
1 file changed, 28 insertions(+), 2 deletions(-)
|
|
|
ae8d13 |
|
|
|
ae8d13 |
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
|
|
|
1443a4 |
index 699d5561c..f3df9766e 100644
|
|
|
ae8d13 |
--- a/src/wayland/meta-xwayland.c
|
|
|
ae8d13 |
+++ b/src/wayland/meta-xwayland.c
|
|
|
1443a4 |
@@ -30,6 +30,7 @@
|
|
|
1443a4 |
#include <glib-unix.h>
|
|
|
1443a4 |
#include <glib.h>
|
|
|
1443a4 |
#include <sys/socket.h>
|
|
|
1443a4 |
+#include <sys/stat.h>
|
|
|
1443a4 |
#include <sys/un.h>
|
|
|
1443a4 |
|
|
|
1443a4 |
#include "compositor/meta-surface-actor-wayland.h"
|
|
|
1443a4 |
@@ -436,9 +437,27 @@ meta_xwayland_override_display_number (int number)
|
|
|
ae8d13 |
display_number_override = number;
|
|
|
ae8d13 |
}
|
|
|
ae8d13 |
|
|
|
ae8d13 |
+static gboolean
|
|
|
ae8d13 |
+ensure_x11_unix_dir (GError **error)
|
|
|
ae8d13 |
+{
|
|
|
ae8d13 |
+ if (mkdir ("/tmp/.X11-unix", 01777) != 0)
|
|
|
ae8d13 |
+ {
|
|
|
ae8d13 |
+ if (errno == EEXIST)
|
|
|
ae8d13 |
+ return TRUE;
|
|
|
ae8d13 |
+
|
|
|
ae8d13 |
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
|
|
|
ae8d13 |
+ "Failed to create directory \"/tmp/.X11-unix\": %s",
|
|
|
ae8d13 |
+ g_strerror (errno));
|
|
|
ae8d13 |
+ return FALSE;
|
|
|
ae8d13 |
+ }
|
|
|
ae8d13 |
+
|
|
|
ae8d13 |
+ return TRUE;
|
|
|
ae8d13 |
+}
|
|
|
ae8d13 |
+
|
|
|
ae8d13 |
static gboolean
|
|
|
ae8d13 |
choose_xdisplay (MetaXWaylandManager *manager)
|
|
|
ae8d13 |
{
|
|
|
ae8d13 |
+ g_autoptr (GError) error = NULL;
|
|
|
ae8d13 |
int display = 0;
|
|
|
ae8d13 |
char *lock_file = NULL;
|
|
|
ae8d13 |
|
|
|
1443a4 |
@@ -447,10 +466,15 @@ choose_xdisplay (MetaXWaylandManager *manager)
|
|
|
ae8d13 |
else if (g_getenv ("RUNNING_UNDER_GDM"))
|
|
|
ae8d13 |
display = 1024;
|
|
|
ae8d13 |
|
|
|
ae8d13 |
- do
|
|
|
1443a4 |
+ if (!ensure_x11_unix_dir (&error))
|
|
|
ae8d13 |
{
|
|
|
ae8d13 |
- g_autoptr (GError) error = NULL;
|
|
|
ae8d13 |
+ g_warning ("Failed to ensure X11 socket directory: %s",
|
|
|
ae8d13 |
+ error->message);
|
|
|
ae8d13 |
+ return FALSE;
|
|
|
ae8d13 |
+ }
|
|
|
ae8d13 |
|
|
|
ae8d13 |
+ do
|
|
|
ae8d13 |
+ {
|
|
|
ae8d13 |
lock_file = create_lock_file (display, &display, &error);
|
|
|
ae8d13 |
if (!lock_file)
|
|
|
ae8d13 |
{
|
|
|
1443a4 |
@@ -466,6 +490,7 @@ choose_xdisplay (MetaXWaylandManager *manager)
|
|
|
ae8d13 |
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_ADDRESS_IN_USE))
|
|
|
ae8d13 |
{
|
|
|
ae8d13 |
meta_verbose ("Failed to bind abstract socket: %s\n", error->message);
|
|
|
1443a4 |
+ g_clear_error (&error);
|
|
|
ae8d13 |
display++;
|
|
|
ae8d13 |
continue;
|
|
|
ae8d13 |
}
|
|
|
1443a4 |
@@ -480,6 +505,7 @@ choose_xdisplay (MetaXWaylandManager *manager)
|
|
|
ae8d13 |
if (manager->unix_fd < 0)
|
|
|
ae8d13 |
{
|
|
|
ae8d13 |
meta_verbose ("Failed to bind unix socket: %s\n", error->message);
|
|
|
1443a4 |
+ g_clear_error (&error);
|
|
|
ae8d13 |
unlink (lock_file);
|
|
|
ae8d13 |
close (manager->abstract_fd);
|
|
|
ae8d13 |
display++;
|
|
|
ae8d13 |
--
|
|
|
1443a4 |
2.29.2
|
|
|
ae8d13 |
|