mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
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. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1626>
This commit is contained in:
parent
d940911478
commit
357f3250cb
@ -30,6 +30,8 @@
|
|||||||
#include <glib-unix.h>
|
#include <glib-unix.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#if defined(HAVE_SYS_RANDOM)
|
#if defined(HAVE_SYS_RANDOM)
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
@ -417,6 +419,23 @@ meta_xwayland_override_display_number (int number)
|
|||||||
display_number_override = 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
|
static gboolean
|
||||||
open_display_sockets (MetaXWaylandManager *manager,
|
open_display_sockets (MetaXWaylandManager *manager,
|
||||||
int display_index,
|
int display_index,
|
||||||
@ -425,6 +444,9 @@ open_display_sockets (MetaXWaylandManager *manager,
|
|||||||
{
|
{
|
||||||
int unix_fd;
|
int unix_fd;
|
||||||
|
|
||||||
|
if (!ensure_x11_unix_dir (error))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
unix_fd = bind_to_unix_socket (display_index, error);
|
unix_fd = bind_to_unix_socket (display_index, error);
|
||||||
if (unix_fd < 0)
|
if (unix_fd < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user