Fix build on linux

This commit is contained in:
markd 2011-02-17 09:02:14 +00:00
parent 0f37d743e6
commit d1221e0c9e
2 changed files with 27 additions and 1 deletions

View file

@ -1,8 +1,9 @@
$NetBSD: distinfo,v 1.24 2011/01/12 08:53:52 adam Exp $
$NetBSD: distinfo,v 1.25 2011/02/17 09:02:14 markd Exp $
SHA1 (mDNSResponder-258.14.tar.gz) = 2a34794ff9a5184ce1e57ccea4001b5af6635f7b
RMD160 (mDNSResponder-258.14.tar.gz) = fbd9dcfa84dbeb9de379066958a0b509af074dbc
Size (mDNSResponder-258.14.tar.gz) = 1833244 bytes
SHA1 (patch-Clients_dns-sd.c) = 8b2a5e7b8b60419122cfdeddb4f5a24ef503592b
SHA1 (patch-aa) = 3f31f10ab6bf0d3ec72b56791cc4db5f24bfeb0b
SHA1 (patch-ab) = 8567d3a9849377fdfd1fd98f1b0dd164561bb6c9
SHA1 (patch-ac) = 3fb065c49ed434f031ea29214ec4140b24f8da64

View file

@ -0,0 +1,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