зеркало из https://github.com/github/putty.git
MacTCP returns canonical names with a trailing dot. We don't want this, so
strip it off. [originally from svn r2612]
This commit is contained in:
Родитель
7b70ed6205
Коммит
c6920b01c4
|
@ -276,6 +276,7 @@ SockAddr mactcp_namelookup(char const *host, char **canonicalname)
|
|||
OSErr err;
|
||||
volatile int done = FALSE;
|
||||
char *realhost;
|
||||
int realhostlen;
|
||||
|
||||
/* Clear the structure. */
|
||||
memset(ret, 0, sizeof(struct SockAddr_tag));
|
||||
|
@ -293,9 +294,13 @@ SockAddr mactcp_namelookup(char const *host, char **canonicalname)
|
|||
continue;
|
||||
ret->resolved = TRUE;
|
||||
|
||||
if (ret->hostinfo.rtnCode == noErr)
|
||||
if (ret->hostinfo.rtnCode == noErr) {
|
||||
realhost = ret->hostinfo.cname;
|
||||
else
|
||||
/* MacTCP puts trailing dots on canonical names. */
|
||||
realhostlen = strlen(realhost);
|
||||
if (realhost[realhostlen - 1] == '.')
|
||||
realhost[realhostlen - 1] = '\0';
|
||||
} else
|
||||
realhost = "";
|
||||
*canonicalname = smalloc(1+strlen(realhost));
|
||||
strcpy(*canonicalname, realhost);
|
||||
|
|
Загрузка…
Ссылка в новой задаче