[mutter] xwayland: Use defines for X11 directory and path
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] xwayland: Use defines for X11 directory and path
- Date: Thu, 18 Mar 2021 17:16:25 +0000 (UTC)
commit 7b5e8550322ef4ab901f1bea8933dec239d8f8ce
Author: Olivier Fourdan <ofourdan redhat com>
Date: Thu Mar 18 10:22:50 2021 +0100
xwayland: Use defines for X11 directory and path
Rather than repeating the same strings for X11 directory and path all
around the code, use a define.
No functional change.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1787>
src/wayland/meta-xwayland.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 48fabbfb33..34837b1612 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -59,6 +59,9 @@
#define XWAYLAND_LISTENFD "-listen"
#endif
+#define X11_TMP_UNIX_DIR "/tmp/.X11-unix"
+#define X11_TMP_UNIX_PATH "/tmp/.X11-unix/X"
+
static int display_number_override = -1;
static void meta_xwayland_stop_xserver (MetaXWaylandManager *manager);
@@ -462,7 +465,7 @@ bind_to_abstract_socket (int display,
addr.sun_family = AF_LOCAL;
name_size = snprintf (addr.sun_path, sizeof addr.sun_path,
- "%c/tmp/.X11-unix/X%d", 0, display);
+ "%c%s%d", 0, X11_TMP_UNIX_PATH, display);
size = offsetof (struct sockaddr_un, sun_path) + name_size;
if (bind (fd, (struct sockaddr *) &addr, size) < 0)
{
@@ -503,7 +506,7 @@ bind_to_unix_socket (int display,
addr.sun_family = AF_LOCAL;
name_size = snprintf (addr.sun_path, sizeof addr.sun_path,
- "/tmp/.X11-unix/X%d", display) + 1;
+ "%s%d", X11_TMP_UNIX_PATH, display) + 1;
size = offsetof (struct sockaddr_un, sun_path) + name_size;
unlink (addr.sun_path);
if (bind (fd, (struct sockaddr *) &addr, size) < 0)
@@ -627,14 +630,14 @@ meta_xwayland_override_display_number (int number)
static gboolean
ensure_x11_unix_dir (GError **error)
{
- if (mkdir ("/tmp/.X11-unix", 01777) != 0)
+ if (mkdir (X11_TMP_UNIX_DIR, 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));
+ "Failed to create directory \"%s\": %s",
+ X11_TMP_UNIX_DIR, g_strerror (errno));
return FALSE;
}
@@ -1222,10 +1225,12 @@ meta_xwayland_shutdown (MetaXWaylandManager *manager)
g_cancellable_cancel (manager->xserver_died_cancellable);
- snprintf (path, sizeof path, "/tmp/.X11-unix/X%d", manager->public_connection.display_index);
+ snprintf (path, sizeof path, "%s%d", X11_TMP_UNIX_PATH,
+ manager->public_connection.display_index);
unlink (path);
- snprintf (path, sizeof path, "/tmp/.X11-unix/X%d", manager->private_connection.display_index);
+ snprintf (path, sizeof path, "%s%d", X11_TMP_UNIX_PATH,
+ manager->private_connection.display_index);
unlink (path);
g_clear_pointer (&manager->public_connection.name, g_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]