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:
Ben Harris 2003-01-15 18:47:41 +00:00
Родитель 7b70ed6205
Коммит c6920b01c4
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -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);