Set h_errno when an error is encountered.
PR: bin/21092 Submitted by: Alexander Kabaev <ak03@gte.com>
This commit is contained in:
parent
317cff677b
commit
055630dcdb
@ -50,6 +50,8 @@ static char rcsid[] = "$FreeBSD$";
|
||||
#define MAXALIASES 35
|
||||
#define MAXADDRS 35
|
||||
|
||||
extern int h_errno;
|
||||
|
||||
#ifdef YP
|
||||
static char *host_aliases[MAXALIASES];
|
||||
static char hostaddr[MAXADDRS];
|
||||
@ -76,15 +78,20 @@ _gethostbynis(name, map, af)
|
||||
case AF_INET6:
|
||||
size = NS_IN6ADDRSZ;
|
||||
errno = EAFNOSUPPORT;
|
||||
h_errno = NETDB_INTERNAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (domain == (char *)NULL)
|
||||
if (yp_get_default_domain (&domain))
|
||||
if (yp_get_default_domain (&domain)) {
|
||||
h_errno = NETDB_INTERNAL;
|
||||
return ((struct hostent *)NULL);
|
||||
}
|
||||
|
||||
if (yp_match(domain, map, name, strlen(name), &result, &resultlen))
|
||||
if (yp_match(domain, map, name, strlen(name), &result, &resultlen)) {
|
||||
h_errno = HOST_NOT_FOUND;
|
||||
return ((struct hostent *)NULL);
|
||||
}
|
||||
|
||||
/* avoid potential memory leak */
|
||||
bcopy((char *)result, (char *)&ypbuf, resultlen);
|
||||
|
Loading…
Reference in New Issue
Block a user