blob: 526f1f75428e7878a9b7d8bca3867d6547b68383 (
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
|
$NetBSD: patch-br,v 1.2 2006/06/27 11:11:52 joerg Exp $
--- nsprpub/pr/src/misc/prnetdb.c.orig 2006-02-28 00:03:51.000000000 +0000
+++ nsprpub/pr/src/misc/prnetdb.c
@@ -325,7 +325,7 @@ _pr_QueryNetIfs(void)
}
#elif (defined(DARWIN) && defined(HAVE_GETIFADDRS)) || defined(FREEBSD) \
- || defined(NETBSD) || defined(OPENBSD)
+ || defined(NETBSD) || defined(OPENBSD) || defined(DRAGONFLY)
/*
* Use the BSD getifaddrs function.
@@ -2111,7 +2111,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;
|