1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 11:02:48 -05:00

OS X Leopard, it turns out, has a new and exciting strategy for

addressing X displays. Update PuTTY's display-name-to-Unix-socket-
path translation code to cope with it, thus causing X forwarding to
start working again on Leopard.

[originally from svn r8020]
This commit is contained in:
Simon Tatham
2008-05-28 19:23:57 +00:00
parent b0dc24a779
commit 14d825d42f
5 changed files with 25 additions and 8 deletions

View File

@ -1292,15 +1292,29 @@ int net_service_lookup(char *service)
return 0;
}
SockAddr platform_get_x11_unix_address(int displaynum, char **canonicalname)
SockAddr platform_get_x11_unix_address(const char *display, int displaynum,
char **canonicalname)
{
SockAddr ret = snew(struct SockAddr_tag);
int n;
memset(ret, 0, sizeof *ret);
ret->family = AF_UNIX;
n = snprintf(ret->hostname, sizeof ret->hostname,
"%s%d", X11_UNIX_PATH, displaynum);
/*
* Mac OS X Leopard uses an innovative X display naming
* convention in which the entire display name is the path to
* the Unix socket, including the trailing :0 which only
* _looks_ like a display number. Heuristically, I think
* detecting this by means of a leading slash ought to be
* adequate.
*/
if (display[0] == '/') {
n = snprintf(ret->hostname, sizeof ret->hostname,
"%s", display);
} else {
n = snprintf(ret->hostname, sizeof ret->hostname,
"%s%d", X11_UNIX_PATH, displaynum);
}
if(n < 0)
ret->error = "snprintf failed";
else if(n >= sizeof ret->hostname)