aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGunter Knauf <gk@gknw.de>2009-07-04 01:04:23 +0000
committerGunter Knauf <gk@gknw.de>2009-07-04 01:04:23 +0000
commit83fb285d401a68e87df85662dbba44b343edb6fd (patch)
treef47a4d65b504386883ab43dd8c5642fae100dae6 /lib
parent3050f1067624c1607bf638d20dd02ba692ff6289 (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.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 59fc1157a..4c9bcd011 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -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 */
}