diff options
author | Tuncer Ayaz <[email protected]> | 2015-11-11 12:37:09 +0100 |
---|---|---|
committer | Tuncer Ayaz <[email protected]> | 2015-11-14 12:19:04 +0100 |
commit | 192c4a80c7d6fe9949aecb864901c4a3d9549f36 (patch) | |
tree | d73f2bde3e3237840117bf5dc85d930de157fa10 | |
parent | ba49561cf3e2167acd5457de93b05e772f2fb16a (diff) | |
download | otp-192c4a80c7d6fe9949aecb864901c4a3d9549f36.tar.gz otp-192c4a80c7d6fe9949aecb864901c4a3d9549f36.tar.bz2 otp-192c4a80c7d6fe9949aecb864901c4a3d9549f36.zip |
musl: fix gethostbyname_r/gethostbyaddr_ selection
To fix conditional selection of the actually available gethostbyname_r
and gethostbyaddr_r, we replace __GLIBC__ with __linux__. @zenhack
tested this to work with gcc and clang targeting glibc, uclibc, musl,
and bionic.
The proper way to check this is through configure.in.
-rw-r--r-- | lib/erl_interface/src/connect/ei_resolve.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/erl_interface/src/connect/ei_resolve.c b/lib/erl_interface/src/connect/ei_resolve.c index 3f1be2b17d..6381b02393 100644 --- a/lib/erl_interface/src/connect/ei_resolve.c +++ b/lib/erl_interface/src/connect/ei_resolve.c @@ -601,6 +601,16 @@ struct hostent *ei_gethostbyaddr(const char *addr, int len, int type) return gethostbyaddr(addr, len, type); } +/* + * Imprecise way to select the actually available gethostbyname_r and + * gethostbyaddr_r. + * + * TODO: check this properly in configure.in + */ +#if (defined(__linux__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__)) + #define HAVE_GETHOSTBYADDR_R_8 1 +#endif + struct hostent *ei_gethostbyaddr_r(const char *addr, int length, int type, @@ -616,7 +626,7 @@ struct hostent *ei_gethostbyaddr_r(const char *addr, #ifndef HAVE_GETHOSTBYNAME_R return my_gethostbyaddr_r(addr,length,type,hostp,buffer,buflen,h_errnop); #else -#if (defined(__GLIBC__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__)) +#ifdef HAVE_GETHOSTBYADDR_R_8 struct hostent *result; gethostbyaddr_r(addr, length, type, hostp, buffer, buflen, &result, @@ -643,7 +653,7 @@ struct hostent *ei_gethostbyname_r(const char *name, #ifndef HAVE_GETHOSTBYNAME_R return my_gethostbyname_r(name,hostp,buffer,buflen,h_errnop); #else -#if (defined(__GLIBC__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__) || defined(__ANDROID__)) +#ifdef HAVE_GETHOSTBYADDR_R_8 struct hostent *result; gethostbyname_r(name, hostp, buffer, buflen, &result, h_errnop); |