diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index 9455326d0..88a4b4c11 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -452,7 +452,6 @@ prepare_auth_file (MetaXWaylandManager *manager) { Xauth auth_entry = { 0 }; g_autoptr (FILE) fp = NULL; - char hostname[HOST_NAME_MAX + 1]; char auth_data[16]; int fd; @@ -460,9 +459,6 @@ prepare_auth_file (MetaXWaylandManager *manager) ".mutter-Xwaylandauth.XXXXXX", NULL); - if (gethostname (hostname, HOST_NAME_MAX) < 0) - g_strlcpy (hostname, "localhost", HOST_NAME_MAX); - if (getrandom (auth_data, sizeof (auth_data), 0) != sizeof (auth_data)) { g_warning ("Failed to get random data: %s", g_strerror (errno)); @@ -470,7 +466,7 @@ prepare_auth_file (MetaXWaylandManager *manager) } auth_entry.family = FamilyLocal; - auth_entry.address = hostname; + auth_entry.address = (char *) g_get_host_name (); auth_entry.address_length = strlen (auth_entry.address); auth_entry.name = (char *) "MIT-MAGIC-COOKIE-1"; auth_entry.name_length = strlen (auth_entry.name);