mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 11:32:04 +00:00
xwayland: Use g_get_host_name instead of gethostname
Since the xauth file is never going to be changed after it is generated, it is safe to use g_get_host_name here. https://gitlab.gnome.org/GNOME/mutter/merge_requests/626 https://gitlab.gnome.org/GNOME/mutter/merge_requests/638
This commit is contained in:
parent
181c7cab32
commit
c35e56196a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user