From 82ec49cec5c78f1ba3d1b5dddedfa77804d9fe5d Mon Sep 17 00:00:00 2001
From: Ismael Luceno <ismael@iodev.co.uk>
Date: Mon, 18 Apr 2022 18:55:20 +0200
Subject: [PATCH 1/5] Fix build against musl libc

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
---
 sysdep.h | 7 ++++++-
 vpnc.c   | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sysdep.h b/sysdep.h
index a5eafd6d87ea..d182e8340313 100644
--- a/sysdep.h
+++ b/sysdep.h
@@ -25,8 +25,11 @@
 #if !defined(__CYGWIN__)
 #include <net/if.h>
 #include <net/if_arp.h>
+/* might conflict with <linux/if_ether.h> */
+#if defined(__linux__) && !defined(_LINUX_IF_ETHER_H)
 #include <netinet/if_ether.h>
 #endif
+#endif
 
 #include "config.h"
 
@@ -38,11 +41,13 @@ int tun_get_hwaddr(int fd, char *dev, uint8_t *hwaddr);
 
 /***************************************************************************/
 #if defined(__linux__) || defined(__GLIBC__)
+#ifdef __GLIBC__
 #include <error.h>
+#define HAVE_ERROR     1
+#endif
 
 #define HAVE_VASPRINTF 1
 #define HAVE_ASPRINTF  1
-#define HAVE_ERROR     1
 #define HAVE_GETLINE   1
 #define HAVE_UNSETENV  1
 #define HAVE_SETENV    1
diff --git a/vpnc.c b/vpnc.c
index 38dc17fcc171..39eb40e86fa5 100644
--- a/vpnc.c
+++ b/vpnc.c
@@ -24,7 +24,7 @@
 #define _GNU_SOURCE
 #include <assert.h>
 #include <unistd.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-- 
2.35.3

