diff options
author | nectar <nectar@FreeBSD.org> | 2000-09-10 19:06:05 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2000-09-10 19:06:05 +0000 |
commit | 4b57274ae448998ee3e93a7657d5fa17e6496036 (patch) | |
tree | 425d0bd2fb2a7860f05d293dcf9253f70c2142d3 /lib | |
parent | 38e967c74742ab74c36b8bdc059758832ad5e0d1 (diff) | |
download | FreeBSD-src-4b57274ae448998ee3e93a7657d5fa17e6496036.zip FreeBSD-src-4b57274ae448998ee3e93a7657d5fa17e6496036.tar.gz |
Set h_errno when an error is encountered.
PR: bin/21092
Submitted by: Alexander Kabaev <ak03@gte.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/gethostbynis.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c index 518d512..f339d03 100644 --- a/lib/libc/net/gethostbynis.c +++ b/lib/libc/net/gethostbynis.c @@ -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); |