Skip to content

Commit 42ff69d

Browse files
committed
uClibc < 0.9.30 didn't have ifaddrs.h
1 parent 8f8f705 commit 42ff69d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/libuv/src/unix/linux.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@
2828
#include <assert.h>
2929
#include <errno.h>
3030

31-
#include <ifaddrs.h>
31+
#define HAVE_IFADDRS_H 1
32+
#ifdef __UCLIBC__
33+
# if __UCLIBC_MAJOR__ < 0 || __UCLIBC_MINOR__ < 9 || __UCLIBC_SUBLEVEL__ < 30
34+
# undef HAVE_IFADDRS_H
35+
# endif
36+
#endif
37+
#ifdef HAVE_IFADDRS_H
38+
# include <ifaddrs.h>
39+
#endif
3240
#include <net/if.h>
3341
#include <sys/param.h>
3442
#include <sys/sysinfo.h>
@@ -457,6 +465,9 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
457465

458466
uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
459467
int* count) {
468+
#ifndef HAVE_IFADDRS_H
469+
return uv__new_artificial_error(UV_ENOSYS);
470+
#else
460471
struct ifaddrs *addrs, *ent;
461472
char ip[INET6_ADDRSTRLEN];
462473
uv_interface_address_t* address;
@@ -520,6 +531,7 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
520531
freeifaddrs(addrs);
521532

522533
return uv_ok_;
534+
#endif
523535
}
524536

525537

0 commit comments

Comments
 (0)