1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-12 18:13:50 -05:00

Stop the segfault on failure to resolve a host name.

[originally from svn r2170]
This commit is contained in:
Simon Tatham 2002-11-01 12:54:22 +00:00
parent 9c5fe60bfe
commit 057eabf46d

View File

@ -208,13 +208,15 @@ SockAddr sk_namelookup(char *host, char **canonicalname)
if ( (h = gethostbyname(host)) )
ret->family = AF_INET;
}
if (ret->family == 0)
if (ret->family == 0) {
ret->error = (h_errno == HOST_NOT_FOUND ||
h_errno == NO_DATA ||
h_errno == NO_ADDRESS ? "Host does not exist" :
h_errno == TRY_AGAIN ?
"Temporary name service failure" :
"gethostbyname: unknown error");
return ret;
}
}
#ifdef IPV6