From: Simon Tatham Date: Sat, 11 Jan 2003 09:46:50 +0000 (+0000) Subject: Hack around an oddity in X display names and xauth. X-Git-Tag: 0.54~574 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=fda998324345ba50a913655754303ce8f0a4cfde;p=PuTTY.git Hack around an oddity in X display names and xauth. [originally from svn r2538] --- 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);