From 0843d0c5b289de06fc098e847fb95d6a02ad6fb3 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 15 Dec 2021 13:33:09 +0100 Subject: [PATCH] avoid linking an undefined function, sysfs is linux only (#474) --- src/first_network_device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/first_network_device.c b/src/first_network_device.c index 3d06217..3af43cc 100644 --- a/src/first_network_device.c +++ b/src/first_network_device.c @@ -25,6 +25,7 @@ #define LOOPBACK_DEV "lo" #endif +#if defined(__linux__) static bool sysfs_devtype(char *dest, size_t n, const char *ifnam) { FILE *fp; char buf[1024]; @@ -54,6 +55,7 @@ static bool sysfs_devtype(char *dest, size_t n, const char *ifnam) { fclose(fp); return true; } +#endif static bool is_virtual(const char *ifname) { char path[1024]; @@ -131,7 +133,7 @@ static net_type_t iface_type(const char *ifname) { close(s); return NET_TYPE_ETHERNET; } -#else +#elif defined(__linux__) char devtype[32]; if (!sysfs_devtype(devtype, sizeof(devtype), ifname))