aboutsummaryrefslogtreecommitdiff
path: root/lib/inet_ntop.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2005-03-15 21:00:46 +0000
committerDan Fandrich <dan@coneharvesters.com>2005-03-15 21:00:46 +0000
commitefaf6886505cd29084af05aa06edc19fd71bdfe9 (patch)
tree471544cf284f9dc3e37b602e2acc9b44d440986e /lib/inet_ntop.c
parent9a5c21c16f12fc3a54f94cad5a95b14e794e9009 (diff)
Fixed ftp support with uClibc due to differing inet_ntoa_r() behaviour.
Diffstat (limited to 'lib/inet_ntop.c')
-rw-r--r--lib/inet_ntop.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index 6b15c025f..293723a7e 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -56,8 +56,19 @@
*/
static const char *inet_ntop4 (const u_char *src, char *dst, size_t size)
{
-#ifdef HAVE_INET_NTOA_R
+#if defined(HAVE_INET_NTOA_R_2_ARGS)
+ const char *ptr;
+ size_t len;
+ curlassert(size >= 16);
+ ptr = inet_ntoa_r(*(struct in_addr*)src, dst);
+ len = strlen(ptr);
+ memmove(dst, ptr, len);
+ dst[len] = 0;
+ return dst;
+
+#elif defined(HAVE_INET_NTOA_R)
return inet_ntoa_r(*(struct in_addr*)src, dst, size);
+
#else
const char *addr = inet_ntoa(*(struct in_addr*)src);