mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-16 12:03:03 -05:00
Stop the segfault on failure to resolve a host name.
[originally from svn r2170]
This commit is contained in:
parent
9c5fe60bfe
commit
057eabf46d
@ -208,13 +208,15 @@ SockAddr sk_namelookup(char *host, char **canonicalname)
|
|||||||
if ( (h = gethostbyname(host)) )
|
if ( (h = gethostbyname(host)) )
|
||||||
ret->family = AF_INET;
|
ret->family = AF_INET;
|
||||||
}
|
}
|
||||||
if (ret->family == 0)
|
if (ret->family == 0) {
|
||||||
ret->error = (h_errno == HOST_NOT_FOUND ||
|
ret->error = (h_errno == HOST_NOT_FOUND ||
|
||||||
h_errno == NO_DATA ||
|
h_errno == NO_DATA ||
|
||||||
h_errno == NO_ADDRESS ? "Host does not exist" :
|
h_errno == NO_ADDRESS ? "Host does not exist" :
|
||||||
h_errno == TRY_AGAIN ?
|
h_errno == TRY_AGAIN ?
|
||||||
"Temporary name service failure" :
|
"Temporary name service failure" :
|
||||||
"gethostbyname: unknown error");
|
"gethostbyname: unknown error");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IPV6
|
#ifdef IPV6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user