mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 03:40:00 -04:00
glibc's gethost*_r() is different to anyone elses.
This commit is contained in:
parent
9115330256
commit
6cf48dea49
2 changed files with 77 additions and 3 deletions
|
|
@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
|
|||
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
|
||||
AC_DIVERT_POP()dnl
|
||||
|
||||
AC_REVISION($Revision: 1.67 $)
|
||||
AC_REVISION($Revision: 1.68 $)
|
||||
|
||||
AC_INIT(resolv/herror.c)
|
||||
AC_PREREQ(2.13)
|
||||
|
|
@ -1515,6 +1515,7 @@ HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
|
|||
HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
|
||||
HOST_R_OK="#define HOST_R_OK hptr"
|
||||
HOST_R_RETURN="#define HOST_R_RETURN struct hostent *"
|
||||
HOST_R_SETANSWER=#undef HOST_R_SETANSWER"
|
||||
HOSTENT_DATA="#undef HOSTENT_DATA"
|
||||
]
|
||||
,
|
||||
|
|
@ -1531,9 +1532,29 @@ HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS HOST_R_ARGS"
|
|||
HOST_R_ERRNO="#define HOST_R_ERRNO NULL"
|
||||
HOST_R_OK="#define HOST_R_OK 0"
|
||||
HOST_R_RETURN="#define HOST_R_RETURN int"
|
||||
HOST_R_SETANSWER=#undef HOST_R_SETANSWER"
|
||||
HOSTENT_DATA="#define HOSTENT_DATA 1"
|
||||
],
|
||||
))
|
||||
AC_TRY_COMPILE([
|
||||
#define __USE_MISC
|
||||
#include <netdb.h>
|
||||
extern int gethostbyname_r __P ((__const char *,
|
||||
struct hostent *,
|
||||
char *, size_t,
|
||||
struct hostent **,
|
||||
int *));
|
||||
],,[
|
||||
HOST_R_ARGS="#define HOST_R_ARGS char *buf, int buflen, struct hostent **answerp, int *h_errnop"
|
||||
HOST_R_BAD="#define HOST_R_BAD ERANGE"
|
||||
HOST_R_COPY="#define HOST_R_COPY buf, buflen"
|
||||
HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
|
||||
HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
|
||||
HOST_R_OK="#define HOST_R_OK 0"
|
||||
HOST_R_RETURN="#define HOST_R_RETURN int"
|
||||
HOST_R_SETANSWER=#define HOST_R_SETANSWER 1"
|
||||
HOSTENT_DATA="#undef HOSTENT_DATA"
|
||||
],
|
||||
)))
|
||||
,
|
||||
HOST_R_ARGS="#define HOST_R_ARGS char *buf, int buflen, int *h_errnop"
|
||||
HOST_R_BAD="#define HOST_R_BAD NULL"
|
||||
|
|
@ -1542,6 +1563,7 @@ HOST_R_COPY_ARGS="#define HOST_R_COPY_ARGS char *buf, int buflen"
|
|||
HOST_R_ERRNO="#define HOST_R_ERRNO *h_errnop = h_errno"
|
||||
HOST_R_OK="#define HOST_R_OK hptr"
|
||||
HOST_R_RETURN="#define HOST_R_RETURN struct hostent *"
|
||||
HOST_R_SETANSWER=#undef HOST_R_SETANSWER"
|
||||
HOSTENT_DATA="#undef HOSTENT_DATA"
|
||||
)
|
||||
AC_SUBST(HOST_R_ARGS)
|
||||
|
|
@ -1551,6 +1573,7 @@ AC_SUBST(HOST_R_COPY_ARGS)
|
|||
AC_SUBST(HOST_R_ERRNO)
|
||||
AC_SUBST(HOST_R_OK)
|
||||
AC_SUBST(HOST_R_RETURN)
|
||||
AC_SUBST(HOST_R_SETANSWER)
|
||||
AC_SUBST(HOSTENT_DATA)
|
||||
|
||||
AC_CHECK_FUNC(endhostent_r,
|
||||
|
|
@ -1888,6 +1911,21 @@ SERV_R_OK="#define SERV_R_OK sptr"
|
|||
SERV_R_RETURN="#define SERV_R_RETURN struct servent *"
|
||||
]
|
||||
,
|
||||
AC_TRY_COMPILE([
|
||||
#include <netdb.h>
|
||||
struct servent *
|
||||
getservent_r __P ((struct servent *, char *, size_t, struct servent **));
|
||||
],[return (0);],
|
||||
[
|
||||
SERV_R_ARGS="#define SERV_R_ARGS char *buf, int buflen, struct servent **answer"
|
||||
SERV_R_BAD="#define SERV_R_BAD (-1)"
|
||||
SERV_R_COPY="#define SERV_R_COPY buf, buflen"
|
||||
SERV_R_COPY_ARGS="#define SERV_R_COPY_ARGS SERV_R_ARGS"
|
||||
SERV_R_OK="#define SERV_R_OK (0)"
|
||||
SERV_R_RETURN="#define SERV_R_RETURN 1"
|
||||
]
|
||||
,
|
||||
)
|
||||
)
|
||||
,
|
||||
SERV_R_ARGS="#define SERV_R_ARGS char *buf, int buflen"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: gethostent_r.c,v 1.3 2001/07/15 23:29:43 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue