From 75ab1ba77467cab272ee8302ca4e9d1be306d2f6 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 17 Feb 2012 14:13:10 -0800 Subject: [PATCH] linux: uclibc <0.9.32 doesn't have uclibc didn't provide ifaddrs.h before version 0.9.32 It explicitly didn't install it because (quoting) "the corresponding functionality is disabled". So, fix libuv on uclibc < 0.9.32 by returning ENOSYS for uv_interface_addresses() --- src/unix/linux.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/unix/linux.c b/src/unix/linux.c index 2f04cb8d..8986eef9 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -36,6 +35,16 @@ #include #include +#define HAVE_IFADDRS_H 1 +#ifdef __UCLIBC__ +# if __UCLIBC_MAJOR__ < 0 || __UCLIBC_MINOR__ < 9 || __UCLIBC_SUBLEVEL__ < 32 +# undef HAVE_IFADDRS_H +# endif +#endif +#ifdef HAVE_IFADDRS_H +# include +#endif + #undef NANOSEC #define NANOSEC 1000000000 @@ -457,6 +466,9 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) { uv_err_t uv_interface_addresses(uv_interface_address_t** addresses, int* count) { +#ifndef HAVE_IFADDRS_H + return uv__new_artificial_error(UV_ENOSYS); +#else struct ifaddrs *addrs, *ent; char ip[INET6_ADDRSTRLEN]; uv_interface_address_t* address; @@ -520,6 +532,7 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses, freeifaddrs(addrs); return uv_ok_; +#endif }