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
|
Backport of commit 60a13b98e9f410c3b1019252f271d3c0f20b2e61 for 2.12.20
From 60a13b98e9f410c3b1019252f271d3c0f20b2e61 Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Date: Fri, 23 Sep 2011 14:39:29 +0000
Subject: a hack to allow compilation on systems without AF_LOCAL.
--- lib/nettle/egd.c
+++ lib/nettle/egd.c
@@ -33,6 +33,12 @@
#include <gnutls_errors.h>
+#ifdef AF_UNIX
+# define LOCAL_SOCKET_TYPE AF_UNIX
+#else
+# define LOCAL_SOCKET_TYPE AF_LOCAL
+#endif
+
#ifndef offsetof
#define offsetof(type, member) ((size_t) &((type *)0)->member)
#endif
@@ -141,12 +147,12 @@
}
memset (&addr, 0, sizeof addr);
- addr.sun_family = AF_LOCAL;
+ addr.sun_family = LOCAL_SOCKET_TYPE;
strcpy (addr.sun_path, name);
addr_len = (offsetof (struct sockaddr_un, sun_path)
+ strlen (addr.sun_path));
- fd = socket (AF_LOCAL, SOCK_STREAM, 0);
+ fd = socket (LOCAL_SOCKET_TYPE, SOCK_STREAM, 0);
if (fd == -1)
{
_gnutls_debug_log ("can't create unix domain socket: %s\n",
|