diff options
Diffstat (limited to 'lib/bind/irs/gethostent_r.c')
-rw-r--r-- | lib/bind/irs/gethostent_r.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/lib/bind/irs/gethostent_r.c b/lib/bind/irs/gethostent_r.c index 24706296..d05e0ef1 100644 --- a/lib/bind/irs/gethostent_r.c +++ b/lib/bind/irs/gethostent_r.c @@ -16,7 +16,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$Id: gethostent_r.c,v 1.2 2001/05/10 07:29:54 marka Exp $"; +static const char rcsid[] = "$Id: gethostent_r.c,v 1.4 2001/07/16 04:23:00 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include <port_before.h> @@ -40,26 +40,50 @@ copy_hostent(struct hostent *, struct hostent *, HOST_R_COPY_ARGS); HOST_R_RETURN gethostbyname_r(const char *name, struct hostent *hptr, HOST_R_ARGS) { struct hostent *he = gethostbyname(name); +#ifdef HOST_R_SETANSWER + int n = 0; +#endif HOST_R_ERRNO; +#ifdef HOST_R_SETANSWER + if (he == NULL || (n = copy_hostent(he, hptr, HOST_R_COPY)) == 0) + *answerp = NULL; + else + *answerp = hptr; + + return (n); +#else if (he == NULL) return (HOST_R_BAD); return (copy_hostent(he, hptr, HOST_R_COPY)); +#endif } HOST_R_RETURN gethostbyaddr_r(const char *addr, int len, int type, struct hostent *hptr, HOST_R_ARGS) { struct hostent *he = gethostbyaddr(addr, len, type); +#ifdef HOST_R_SETANSWER + int n = 0; +#endif HOST_R_ERRNO; +#ifdef HOST_R_SETANSWER + if (he == NULL || (n = copy_hostent(he, hptr, HOST_R_COPY)) == 0) + *answerp = NULL; + else + *answerp = hptr; + + return (n); +#else if (he == NULL) return (HOST_R_BAD); return (copy_hostent(he, hptr, HOST_R_COPY)); +#endif } /* @@ -71,13 +95,25 @@ gethostbyaddr_r(const char *addr, int len, int type, HOST_R_RETURN gethostent_r(struct hostent *hptr, HOST_R_ARGS) { struct hostent *he = gethostent(); +#ifdef HOST_R_SETANSWER + int n = 0; +#endif HOST_R_ERRNO; +#ifdef HOST_R_SETANSWER + if (he == NULL || (n = copy_hostent(he, hptr, HOST_R_COPY)) == 0) + *answerp = NULL; + else + *answerp = hptr; + + return (n); +#else if (he == NULL) return (HOST_R_BAD); return (copy_hostent(he, hptr, HOST_R_COPY)); +#endif } HOST_R_SET_RETURN @@ -223,6 +259,6 @@ copy_hostent(struct hostent *he, struct hostent *hptr, HOST_R_COPY_ARGS) { } #endif /* !HOSTENT_DATA */ #else /* HOST_R_RETURN */ - static int gethostent_r_unknown_systemm = 0; + static int gethostent_r_unknown_system = 0; #endif /* HOST_R_RETURN */ #endif /* !defined(_REENTRANT) || !defined(DO_PTHREADS) */ |