1From 7f41ef32c8c887ee23ca83da4dfd7a4f27e01186 Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Wed, 10 Feb 2016 23:09:51 +0100
4Subject: [PATCH] sysdep.h: don't assume <error.h> is available on all Linux
5 platforms
6
7The current logic in sysdep.h assumes that whenever you have __linux__
8or __GLIBC__ defined, then <error.h> functionality is
9available. However, the <error.h> functionality is a glibc-ism, not
10available in more standard-conformant C libraries such as the musl C
11library. With musl, __linux__ is defined (but of course not
12__GLIBC__). With the current logic, sysdep.h assumes that <error.h> is
13available, which isn't the case.
14
15This patch therefore changes the logic to only use <error.h> when
16__GLIBC__ is defined. It fixes the following build error:
17
18In file included from tunip.c:87:0:
19sysdep.h:41:19: fatal error: error.h: No such file or directory
20 #include <error.h>
21
22Original patch from
23http://git.alpinelinux.org/cgit/aports/tree/testing/vpnc/working.patch.
24
25Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
26---
27 sysdep.h | 5 ++++-
28 1 file changed, 4 insertions(+), 1 deletion(-)
29
30diff --git a/sysdep.h b/sysdep.h
31index 137bf6d..fb65b31 100644
32--- a/sysdep.h
33+++ b/sysdep.h
34@@ -38,11 +38,14 @@ int tun_get_hwaddr(int fd, char *dev, uint8_t *hwaddr);
35
36 /***************************************************************************/
37 #if defined(__linux__) || defined(__GLIBC__)
38+
39+#ifdef __GLIBC__
40 #include <error.h>
41+#define HAVE_ERROR     1
42+#endif
43
44 #define HAVE_VASPRINTF 1
45 #define HAVE_ASPRINTF  1
46-#define HAVE_ERROR     1
47 #define HAVE_UNSETENV  1
48 #define HAVE_SETENV    1
49 #endif
50--
512.6.4
52
53