package/rpcbind: fix musl build
[buildroot-gz.git] / package / vpnc / 0007-sysdep.h-don-t-assume-error.h-is-available-on-all-Li.patch
blob41c6191ea391043e011745bbaae37abee52d2a39
1 From 7f41ef32c8c887ee23ca83da4dfd7a4f27e01186 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Wed, 10 Feb 2016 23:09:51 +0100
4 Subject: [PATCH] sysdep.h: don't assume <error.h> is available on all Linux
5 platforms
7 The current logic in sysdep.h assumes that whenever you have __linux__
8 or __GLIBC__ defined, then <error.h> functionality is
9 available. However, the <error.h> functionality is a glibc-ism, not
10 available in more standard-conformant C libraries such as the musl C
11 library. With musl, __linux__ is defined (but of course not
12 __GLIBC__). With the current logic, sysdep.h assumes that <error.h> is
13 available, which isn't the case.
15 This patch therefore changes the logic to only use <error.h> when
16 __GLIBC__ is defined. It fixes the following build error:
18 In file included from tunip.c:87:0:
19 sysdep.h:41:19: fatal error: error.h: No such file or directory
20 #include <error.h>
22 Original patch from
23 http://git.alpinelinux.org/cgit/aports/tree/testing/vpnc/working.patch.
25 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
26 ---
27 sysdep.h | 5 ++++-
28 1 file changed, 4 insertions(+), 1 deletion(-)
30 diff --git a/sysdep.h b/sysdep.h
31 index 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);
36 /***************************************************************************/
37 #if defined(__linux__) || defined(__GLIBC__)
39 +#ifdef __GLIBC__
40 #include <error.h>
41 +#define HAVE_ERROR 1
42 +#endif
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 --
51 2.6.4