run: Treat DISPLAY=unix:42 the same as :42

xauth and xcb both treat this as a request to use AF_UNIX.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2022-01-26 15:52:49 +00:00
committed by Alexander Larsson
parent 18db8e8713
commit c3395a0e83
2 changed files with 2 additions and 1 deletions

View File

@@ -232,7 +232,7 @@ flatpak_run_parse_x11_display (const char *display,
while (g_ascii_isdigit (*display_nr_end))
display_nr_end++;
if (display == colon)
if (display == colon || g_str_has_prefix (display, "unix:"))
{
*display_nr_out = g_strndup (display_nr, display_nr_end - display_nr);
*x11_socket = g_strdup_printf ("/tmp/.X11-unix/X%s", *display_nr_out);

View File

@@ -1779,6 +1779,7 @@ static const DisplayTest x11_display_tests[] =
{ ":0", FamilyLocal, "/tmp/.X11-unix/X0", NULL, "0" },
{ ":0.0", FamilyLocal, "/tmp/.X11-unix/X0", NULL, "0" },
{ ":42.0", FamilyLocal, "/tmp/.X11-unix/X42", NULL, "42" },
{ "unix:42", FamilyLocal, "/tmp/.X11-unix/X42", NULL, "42" },
{ "othermachine:23", FamilyWild, NULL, "othermachine", "23" },
{ "bees.example.com:23", FamilyWild, NULL, "bees.example.com", "23" },
{ "[::1]:0", FamilyInternet6, NULL, "::1", "0" },