]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Hack around an oddity in X display names and xauth.
authorSimon Tatham <anakin@pobox.com>
Sat, 11 Jan 2003 09:46:50 +0000 (09:46 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 11 Jan 2003 09:46:50 +0000 (09:46 +0000)
[originally from svn r2538]

unix/ux_x11.c

index 7753c85464d06b429613ea0f924c8f37edde05a5..61b4f04c8070ddbca161f1a5d81728ff13ec3e99 100644 (file)
@@ -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);