summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2003-07-21 23:17:54 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2003-07-21 23:17:54 +0000
commit7c171fd853df4458f7359bbf10a219b6fda60f7e (patch)
tree95d938735126f179e815f7df50b9abfc88da4c6f /lib
parent5bf9e47a70ebeaaf642908413a4fff56cb983f62 (diff)
bug library/3297: lib/libc/net/get{addr,name}info should share mutex
'Looks right' deraadt@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/getaddrinfo.c5
-rw-r--r--lib/libc/net/getnameinfo.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 0d14de7499f..eb7bd7b3b18 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo.c,v 1.47 2003/05/14 05:38:34 itojun Exp $ */
+/* $OpenBSD: getaddrinfo.c,v 1.48 2003/07/21 23:17:53 marc Exp $ */
/* $KAME: getaddrinfo.c,v 1.31 2000/08/31 17:36:43 itojun Exp $ */
/*
@@ -885,7 +885,8 @@ get_port(ai, servname, matchonly)
struct servent *sp;
int port;
int allownumeric;
- _THREAD_PRIVATE_MUTEX(serv_mutex);
+ /* mutex is defined in getnameinfo.c */
+ extern pthread_mutex_t __THREAD_MUTEX_NAME(serv_mutex);
if (servname == NULL)
return 0;
diff --git a/lib/libc/net/getnameinfo.c b/lib/libc/net/getnameinfo.c
index d3a9678cbd6..da5df507ab0 100644
--- a/lib/libc/net/getnameinfo.c
+++ b/lib/libc/net/getnameinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnameinfo.c,v 1.26 2003/01/28 04:58:00 marc Exp $ */
+/* $OpenBSD: getnameinfo.c,v 1.27 2003/07/21 23:17:53 marc Exp $ */
/* $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $ */
/*
@@ -88,6 +88,11 @@ static int ip6_parsenumeric(const struct sockaddr *, const char *, char *,
static int ip6_sa2str(const struct sockaddr_in6 *, char *, size_t, int);
#endif
+/*
+ * this mutex is also used by get_port in getaddrinfo.c
+ */
+pthread_mutex_t __THREAD_MUTEX_NAME(serv_mutex) = PTHREAD_MUTEX_INITIALIZER;
+
int
getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
const struct sockaddr *sa;
@@ -108,7 +113,6 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
int h_error;
char numserv[512];
char numaddr[512];
- _THREAD_PRIVATE_MUTEX(serv_mutex);
if (sa == NULL)
return EAI_FAIL;