Fix _dns_ghbyname() to return NS_TRYAGAIN instead of NS_NOTFOUND

on temporary nameserver failure. This is necessary to get
getipnodebyname(3) to correctly return h_errno=TRY_AGAIN instead
of HOST_NOT_FOUND.

Reviewed by:	green, thomas
MFC after:	1 week
This commit is contained in:
Pierre Beyssac 2004-04-05 20:18:48 +00:00
parent cf497adabf
commit e651d83aa3

View file

@ -1565,7 +1565,8 @@ _res_search_multi(name, rtl, errp)
continue;
hp = _hpcopy(&hpbuf, errp);
hp0 = _hpmerge(hp0, hp, errp);
}
} else
*errp = h_errno;
}
if (hp0 != NULL) {
free(buf);
@ -1604,7 +1605,8 @@ _res_search_multi(name, rtl, errp)
continue;
hp = _hpcopy(&hpbuf, errp);
hp0 = _hpmerge(hp0, hp, errp);
}
} else
*errp = h_errno;
}
if (hp0 != NULL) {
free(buf);
@ -1677,7 +1679,8 @@ _res_search_multi(name, rtl, errp)
continue;
hp = _hpcopy(&hpbuf, errp);
hp0 = _hpmerge(hp0, hp, errp);
}
} else
*errp = h_errno;
}
if (hp0 != NULL) {
free(buf);
@ -1739,7 +1742,12 @@ _dns_ghbyname(void *rval, void *cb_data, va_list ap)
rtl = &rtl4;
#endif
*(struct hostent **)rval = _res_search_multi(name, rtl, errp);
return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
if (*(struct hostent **)rval != NULL)
return NS_SUCCESS;
else if (*errp == TRY_AGAIN)
return NS_TRYAGAIN;
else
return NS_NOTFOUND;
}
static int