From 8b9d148c7193dd62793a62b4cdaa9a2ece0ad571 Mon Sep 17 00:00:00 2001 From: lukem Date: Mon, 18 Jan 1999 05:26:08 +0000 Subject: [PATCH] before each call to nsdispatch(), set h_errno to NETDB_INTERNAL, and only change to NETDB_SUCCESS if nsdispatch() returns NS_SUCCESS. it is up to the internal methods to change h_errno from NETDB_INTERNAL to a more appropriate value when an error is detected. --- lib/libc/net/gethnamaddr.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/libc/net/gethnamaddr.c b/lib/libc/net/gethnamaddr.c index dfb9dc79855a..95d28b2f9dc6 100644 --- a/lib/libc/net/gethnamaddr.c +++ b/lib/libc/net/gethnamaddr.c @@ -1,4 +1,4 @@ -/* $NetBSD: gethnamaddr.c,v 1.9 1999/01/16 07:48:23 lukem Exp $ */ +/* $NetBSD: gethnamaddr.c,v 1.10 1999/01/18 05:26:08 lukem Exp $ */ /* * ++Copyright++ 1985, 1988, 1993 @@ -61,7 +61,7 @@ static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp "; #else -__RCSID("$NetBSD: gethnamaddr.c,v 1.9 1999/01/16 07:48:23 lukem Exp $"); +__RCSID("$NetBSD: gethnamaddr.c,v 1.10 1999/01/18 05:26:08 lukem Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -595,10 +595,9 @@ gethostbyname2(name, af) } hp = (struct hostent *)NULL; - if (nsdispatch(&hp, dtab, NSDB_HOSTS, name, len, af) != NS_SUCCESS) { - h_errno = HOST_NOT_FOUND; + h_errno = NETDB_INTERNAL; + if (nsdispatch(&hp, dtab, NSDB_HOSTS, name, len, af) != NS_SUCCESS) return (struct hostent *)NULL; - } h_errno = NETDB_SUCCESS; return (hp); } @@ -647,10 +646,10 @@ gethostbyaddr(addr, len, af) return (NULL); } hp = (struct hostent *)NULL; - if (nsdispatch(&hp, dtab, NSDB_HOSTS, uaddr, len, af) != NS_SUCCESS) { - h_errno = HOST_NOT_FOUND; + h_errno = NETDB_INTERNAL; + if (nsdispatch(&hp, dtab, NSDB_HOSTS, uaddr, len, af) != NS_SUCCESS) return (struct hostent *)NULL; - } + h_errno = NETDB_SUCCESS; return (hp); }