From 9939292a8f1e9b00e3e09192e966c88afb473c7c Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 11 Jan 2003 09:46:50 +0000 Subject: [PATCH] Hack around an oddity in X display names and xauth. git-svn-id: svn://svn.tartarus.org/sgt/putty@2538 cda61777-01e9-0310-a592-d414129be87e --- unix/ux_x11.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/unix/ux_x11.c b/unix/ux_x11.c index 7753c854..61b4f04c 100644 --- a/unix/ux_x11.c +++ b/unix/ux_x11.c @@ -14,7 +14,15 @@ void platform_get_x11_auth(char *display, int *protocol, int maxsize = *datalen; char *localbuf; - command = dupprintf("xauth list %s 2>/dev/null", display); + /* + * Normally we should run `xauth list DISPLAYNAME'. However, + * there's an oddity when the display is local: the display + * `localhost:0' (or `:0') should become just `:0'. + */ + if (!strncmp(display, "localhost:", 10)) + command = dupprintf("xauth list %s 2>/dev/null", display+9); + else + command = dupprintf("xauth list %s 2>/dev/null", display); fp = popen(command, "r"); sfree(command); -- 2.11.0