summaryrefslogtreecommitdiff
path: root/devel/libFoundation/patches/patch-Foundation_NSHost.m
blob: 1aba2b581e2e53a8c3b9ed966a5731afcb23f2b0 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
$NetBSD: patch-Foundation_NSHost.m,v 1.1 2012/07/20 23:46:44 marino Exp $

Add macros for DragonFly version of gethostbyname_r and gethostbyaddr_r
XXX int	gethostbyaddr_r(const void *, socklen_t, int, struct hostent *,
			char *, size_t, struct hostent **, int *);
XXX int	gethostbyname_r(const char *, struct hostent *, char *, size_t,
			struct hostent **, int *);

--- Foundation/NSHost.m.orig	2008-11-02 16:00:07.000000000 +0000
+++ Foundation/NSHost.m
@@ -205,6 +205,9 @@ static NSRecursiveLock     *hostsLock =
     int            hErrno;
     // size as described in "UNIX Network Programming" by Richard Stevens
     char           buffer[8192]; 
+#if defined(__DragonFly__)
+    struct hostent *result;
+#endif 
 #else
     struct hostent *hostEntity;
 #endif
@@ -223,7 +226,12 @@ static NSRecursiveLock     *hostsLock =
 
 #if HAVE_GETHOSTBYNAME_R && !defined(linux)
     if (gethostbyname_r([name cString], &hostEntity,
-                        buffer, sizeof(buffer), &hErrno) == NULL) {
+                        buffer, sizeof(buffer),
+#if defined(__DragonFly__)
+                        &result, &hErrno) == 0) {
+#else
+                        &hErrno) == NULL) {
+#endif
         RELEASE(self);
         return nil;
     }
@@ -252,6 +260,9 @@ static NSRecursiveLock     *hostsLock =
     int            hErrno;
     // as described in "UNIX Network Programming" by Richard Stevens
     char           buffer[8192]; 
+#if defined(__DragonFly__)
+    struct hostent *result;
+#endif 
 #else
     struct hostent *hostEntity;
 #endif
@@ -277,7 +288,12 @@ static NSRecursiveLock     *hostsLock =
 
 #if HAVE_GETHOSTBYADDR_R && !defined(linux)
     if (gethostbyaddr_r((char*)&ipAddress, sizeof(ipAddress), AF_INET,
-                        &hostEntity, buffer, sizeof(buffer), &hErrno) == NULL) {
+                        &hostEntity, buffer, sizeof(buffer),
+#if defined(__DragonFly__)
+                        &result, &hErrno) == 0) {
+#else
+                        &hErrno) == NULL) {
+#endif
         RELEASE(self);
         return nil;
     }