From 400ca043c73fb2e2db6d62b47183873b5a5966cd Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 24 Aug 2000 14:26:06 +0000 Subject: [PATCH] inet_ntoa_r() usage made more portable --- lib/ftp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/ftp.c b/lib/ftp.c index 9017c20..db64c63 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -38,14 +38,14 @@ * ------------------------------------------------------------ ****************************************************************************/ +#include "setup.h" + #include #include #include #include #include -#include "setup.h" - #ifdef HAVE_UNISTD_H #include #endif @@ -680,7 +680,10 @@ CURLcode _ftp(struct connectdata *conn) unsigned short ip[5]; (void) memcpy(&in.s_addr, *h->h_addr_list, sizeof (in.s_addr)); #if defined (HAVE_INET_NTOA_R) - sscanf( inet_ntoa_r(in, ntoa_buf, sizeof(ntoa_buf)), "%hu.%hu.%hu.%hu", + /* ignore the return code from inet_ntoa_r() as it is int or + char * depending on system */ + inet_ntoa_r(in, ntoa_buf, sizeof(ntoa_buf)); + sscanf( ntoa_buf, "%hu.%hu.%hu.%hu", &ip[0], &ip[1], &ip[2], &ip[3]); #else sscanf( inet_ntoa(in), "%hu.%hu.%hu.%hu", @@ -815,7 +818,7 @@ CURLcode _ftp(struct connectdata *conn) infof(data, "Connecting to %s (%s) port %u\n", answer?answer->h_name:newhost, #if defined(HAVE_INET_NTOA_R) - ip_addr = inet_ntoa_r(in, ntoa_buf, sizeof(ntoa_buf)), + inet_ntoa_r(in, ip_addr=ntoa_buf, sizeof(ntoa_buf)), #else ip_addr = inet_ntoa(in), #endif -- 2.7.4