blob: 74ec1569e79f13b4b542cdee8b0109e15fef878b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
$NetBSD: patch-ad,v 1.5 2009/04/07 08:05:50 hasso Exp $
--- pr/src/misc/prnetdb.c.orig 2006-11-14 19:41:59 +0200
+++ pr/src/misc/prnetdb.c 2009-04-03 18:29:50 +0300
@@ -113,6 +113,11 @@ PRLock *_pr_dnsLock = NULL;
#define _PR_HAVE_5_ARG_GETPROTO_R
#endif
+#if __DragonFly_version >= 200202
+#define _PR_HAVE_GETPROTO_R
+#define _PR_HAVE_5_ARG_GETPROTO_R
+#endif
+
#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
#define _PR_HAVE_GETPROTO_R
#define _PR_HAVE_5_ARG_GETPROTO_R
@@ -2115,7 +2120,17 @@ PR_IMPLEMENT(PRAddrInfo *) PR_GetAddrInf
*/
hints.ai_socktype = SOCK_STREAM;
+/* NetBSD >= 2.99.9 has a thread-safe resolver */
+#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 299000900
+ LOCK_DNS();
+#endif
+
rv = GETADDRINFO(hostname, NULL, &hints, &res);
+
+#if defined(__NetBSD_Version__) && __NetBSD_Version__ < 299000900
+ UNLOCK_DNS();
+#endif
+
if (rv == 0)
return (PRAddrInfo *) res;
|