Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
BIND
Commits
6cf48dea
Commit
6cf48dea
authored
Jul 16, 2001
by
Mark Andrews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
glibc's gethost*_r() is different to anyone elses.
parent
91153302
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
3 deletions
+77
-3
lib/bind/configure.in
lib/bind/configure.in
+40
-2
lib/bind/irs/gethostent_r.c
lib/bind/irs/gethostent_r.c
+37
-1
No files found.
lib/bind/configure.in
View file @
6cf48dea
...
...
@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.6
7
$)
AC_REVISION($Revision: 1.6
8
$)
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"
...
...
lib/bind/irs/gethostent_r.c
View file @
6cf48dea
...
...
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static
const
char
rcsid
[]
=
"$Id: gethostent_r.c,v 1.
3
2001/07/1
5 23:29:43
marka Exp $"
;
static
const
char
rcsid
[]
=
"$Id: gethostent_r.c,v 1.
4
2001/07/1
6 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment