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
101e6adf
Commit
101e6adf
authored
Jul 16, 2001
by
Mark Andrews
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
glibc getproto*_r()
parent
fd61f111
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
4 deletions
+66
-4
lib/bind/configure.in
lib/bind/configure.in
+24
-1
lib/bind/include/netdb.h
lib/bind/include/netdb.h
+9
-1
lib/bind/irs/getprotoent_r.c
lib/bind/irs/getprotoent_r.c
+32
-2
lib/bind/port_before.h.in
lib/bind/port_before.h.in
+1
-0
No files found.
lib/bind/configure.in
View file @
101e6adf
...
...
@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.7
1
$)
AC_REVISION($Revision: 1.7
2
$)
AC_INIT(resolv/herror.c)
AC_PREREQ(2.13)
...
...
@@ -1792,9 +1792,30 @@ PROTO_R_BAD="#define PROTO_R_BAD NULL"
PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS PROTO_R_ARGS"
PROTO_R_OK="#define PROTO_R_OK pptr"
PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
PROTO_R_RETURN="#define PROTO_R_RETURN struct protoent *"
]
,
AC_TRY_COMPILE(
[
#include <netdb.h>
int getprotoent_r (struct protoent *, char *, size_t, struct protoent **);
]
,
[return (0);]
,
[
PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, size_t buflen, struct protoent **answerp"
PROTO_R_BAD="#define PROTO_R_BAD ERANGE"
PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS char *buf, size_t buflen"
PROTO_R_OK="#define PROTO_R_OK 0"
PROTO_R_SETANSWER="#define PROTO_R_SETANSWER 1"
PROTO_R_RETURN="#define PROTO_R_RETURN int"
]
,
)
)
,
PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, int buflen"
...
...
@@ -1802,6 +1823,7 @@ PROTO_R_BAD="#define PROTO_R_BAD NULL"
PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS PROTO_R_ARGS"
PROTO_R_OK="#define PROTO_R_OK pptr"
PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
PROTO_R_RETURN="#define PROTO_R_RETURN struct protoent *"
)
AC_SUBST(PROTO_R_ARGS)
...
...
@@ -1809,6 +1831,7 @@ AC_SUBST(PROTO_R_BAD)
AC_SUBST(PROTO_R_COPY)
AC_SUBST(PROTO_R_COPY_ARGS)
AC_SUBST(PROTO_R_OK)
AC_SUBST(PROTO_R_SETANSWER)
AC_SUBST(PROTO_R_RETURN)
AC_CHECK_FUNC(endprotoent_r,
...
...
lib/bind/include/netdb.h
View file @
101e6adf
...
...
@@ -86,7 +86,7 @@
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* $Id: netdb.h,v 1.
8
2001/07/16 08:
05:19
marka Exp $
* $Id: netdb.h,v 1.
9
2001/07/16 08:
37:44
marka Exp $
*/
#ifndef _NETDB_H_
...
...
@@ -470,11 +470,19 @@ struct netent *getnetent_r __P((struct netent *, char *, int));
void
setnetent_r
__P
((
int
));
void
endnetent_r
__P
((
void
));
#ifdef __GLIBC__
int
getprotobyname_r
__P
((
const
char
*
,
struct
protoent
*
,
char
*
,
size_t
,
struct
protoent
**
));
int
getprotobynumber_r
__P
((
int
,
struct
protoent
*
,
char
*
,
size_t
,
struct
protoent
**
));
int
getprotoent_r
__P
((
struct
protoent
*
,
char
*
,
size_t
,
struct
protoent
**
));
#else
struct
protoent
*
getprotobyname_r
__P
((
const
char
*
,
struct
protoent
*
,
char
*
,
int
));
struct
protoent
*
getprotobynumber_r
__P
((
int
,
struct
protoent
*
,
char
*
,
int
));
struct
protoent
*
getprotoent_r
__P
((
struct
protoent
*
,
char
*
,
int
));
#endif
void
setprotoent_r
__P
((
int
));
void
endprotoent_r
__P
((
void
));
...
...
lib/bind/irs/getprotoent_r.c
View file @
101e6adf
...
...
@@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static
const
char
rcsid
[]
=
"$Id: getprotoent_r.c,v 1.
2
2001/07/1
5 23:29
:4
6
marka Exp $"
;
static
const
char
rcsid
[]
=
"$Id: getprotoent_r.c,v 1.
3
2001/07/1
6 08:37
:4
5
marka Exp $"
;
#endif
/* LIBC_SCCS and not lint */
#include <port_before.h>
...
...
@@ -39,21 +39,41 @@ copy_protoent(struct protoent *, struct protoent *, PROTO_R_COPY_ARGS);
PROTO_R_RETURN
getprotobyname_r
(
const
char
*
name
,
struct
protoent
*
pptr
,
PROTO_R_ARGS
)
{
struct
protoent
*
pe
=
getprotobyname
(
name
);
#ifdef PROTO_R_SETANSWER
int
n
=
0
;
if
(
pe
==
NULL
||
(
n
=
copy_protoent
(
pe
,
pptr
,
PROTO_R_COPY
))
!=
0
)
*
answerp
=
NULL
;
else
*
answerp
=
pptr
;
return
(
n
);
#else
if
(
pe
==
NULL
)
return
(
PROTO_R_BAD
);
return
(
copy_protoent
(
pe
,
pptr
,
PROTO_R_COPY
));
#endif
}
PROTO_R_RETURN
getprotobynumber_r
(
int
proto
,
struct
protoent
*
pptr
,
PROTO_R_ARGS
)
{
struct
protoent
*
pe
=
getprotobynumber
(
proto
);
#ifdef PROTO_R_SETANSWER
int
n
=
0
;
if
(
pe
==
NULL
||
(
n
=
copy_protoent
(
pe
,
pptr
,
PROTO_R_COPY
))
!=
0
)
*
answerp
=
NULL
;
else
*
answerp
=
pptr
;
return
(
n
);
#else
if
(
pe
==
NULL
)
return
(
PROTO_R_BAD
);
return
(
copy_protoent
(
pe
,
pptr
,
PROTO_R_COPY
));
#endif
}
/*
...
...
@@ -65,11 +85,21 @@ getprotobynumber_r(int proto, struct protoent *pptr, PROTO_R_ARGS) {
PROTO_R_RETURN
getprotoent_r
(
struct
protoent
*
pptr
,
PROTO_R_ARGS
)
{
struct
protoent
*
pe
=
getprotoent
();
#ifdef PROTO_R_SETANSWER
int
n
=
0
;
if
(
pe
==
NULL
||
(
n
=
copy_protoent
(
pe
,
pptr
,
PROTO_R_COPY
))
!=
0
)
*
answerp
=
NULL
;
else
*
answerp
=
pptr
;
return
(
n
);
#else
if
(
pe
==
NULL
)
return
(
PROTO_R_BAD
);
return
(
copy_protoent
(
pe
,
pptr
,
PROTO_R_COPY
));
#endif
}
PROTO_R_SET_RETURN
...
...
@@ -114,7 +144,7 @@ copy_protoent(struct protoent *pe, struct protoent *pptr, PROTO_R_COPY_ARGS) {
len
+=
strlen
(
pe
->
p_name
)
+
1
;
len
+=
numptr
*
sizeof
(
char
*
);
if
(
len
>
buflen
)
{
if
(
len
>
(
int
)
buflen
)
{
errno
=
ERANGE
;
return
(
PROTO_R_BAD
);
}
...
...
lib/bind/port_before.h.in
View file @
101e6adf
...
...
@@ -84,6 +84,7 @@ struct timezone; /* silence warning */
@PROTO_R_END_RETURN@
@PROTO_R_ENT_ARGS@
@PROTO_R_OK@
@PROTO_R_SETANSWER@
@PROTO_R_RETURN@
@PROTO_R_SET_RESULT@
@PROTO_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