diff options
author | Gunter Knauf <gk@gknw.de> | 2009-07-04 01:04:23 +0000 |
---|---|---|
committer | Gunter Knauf <gk@gknw.de> | 2009-07-04 01:04:23 +0000 |
commit | 83fb285d401a68e87df85662dbba44b343edb6fd (patch) | |
tree | f47a4d65b504386883ab43dd8c5642fae100dae6 /lib | |
parent | 3050f1067624c1607bf638d20dd02ba692ff6289 (diff) |
Markus Koetter provided a patch to avoid getnameinfo() usage which broke a couple of both IPv4 and IPv6 autobuilds.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftp.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -1000,22 +1000,23 @@ static CURLcode ftp_state_use_port(struct connectdata *conn, the IP from the control connection */ sslen = sizeof(ss); - if(getsockname(conn->sock[FIRSTSOCKET], (struct sockaddr *)&ss, &sslen)) { + if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) { failf(data, "getsockname() failed: %s", Curl_strerror(conn, SOCKERRNO) ); if (addr) free(addr); return CURLE_FTP_PORT_FAILED; } - - sslen = sizeof(ss); - rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf), NULL, - 0, NIFLAGS); - if(rc) { - failf(data, "getnameinfo() returned %d", rc); - if (addr) - free(addr); - return CURLE_FTP_PORT_FAILED; + switch(sa->sa_family) + { +#ifdef ENABLE_IPV6 + case AF_INET6: + Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf)); + break; +#endif + default: + Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf)); + break; } host = hbuf; /* use this host name */ } |