summaryrefslogtreecommitdiff
path: root/net/mDNSResponder/patches/patch-Clients_dns-sd.c
blob: c2363e08d48c8c26b1f81e4f5d9bd2676746cd3b (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
$NetBSD: patch-Clients_dns-sd.c,v 1.1 2011/02/17 09:02:14 markd Exp $

--- Clients/dns-sd.c.orig	2010-05-15 00:16:11.000000000 +0000
+++ Clients/dns-sd.c
@@ -169,9 +169,20 @@ cl dns-sd.c -I../mDNSShared -DNOT_HAVE_G
 	#include <netinet/in.h>		// For struct sockaddr_in()
 	#include <arpa/inet.h>		// For inet_addr()
 	#include <net/if.h>			// For if_nametoindex()
+#ifdef __linux__
 	static const char kFilePathSep = '/';
+	static size_t _sa_len(const struct sockaddr *addr)
+		{
+		if (addr->sa_family == AF_INET) return (sizeof(struct sockaddr_in));
+		else if (addr->sa_family == AF_INET6) return (sizeof(struct sockaddr_in6));
+		else return (sizeof(struct sockaddr));
+		}
+
+#   define SA_LEN(addr) (_sa_len(addr))
+#else
 	#define SA_LEN(addr) ((addr)->sa_len)
 #endif
+#endif
 
 #if (TEST_NEW_CLIENTSTUB && !defined(__APPLE_API_PRIVATE))
 #define __APPLE_API_PRIVATE 1