Fix a segfault (addr->error was unpredictable following a dotted-dec lookup)

[originally from svn r768]
This commit is contained in:
Simon Tatham 2000-10-26 08:25:43 +00:00
Родитель 5f73cf092f
Коммит 8fff1e4821
1 изменённых файлов: 1 добавлений и 1 удалений

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

@ -61,6 +61,7 @@ SockAddr sk_namelookup(char *host, char **canonicalname) {
unsigned long a;
struct hostent *h;
ret->error = NULL;
if ( (a = inet_addr(host)) == (unsigned long) INADDR_NONE) {
if ( (h = gethostbyname(host)) == NULL) {
DWORD err = WSAGetLastError();
@ -69,7 +70,6 @@ SockAddr sk_namelookup(char *host, char **canonicalname) {
err == WSATRY_AGAIN ? "Host not found" :
"gethostbyname: unknown error");
} else {
ret->error = NULL;
memcpy (&a, h->h_addr, sizeof(a));
*canonicalname = h->h_name;
}