aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ftp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 740926a87..49a1d82d0 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -209,12 +209,12 @@ static CURLcode AllowServerConnect(struct connectdata *conn)
default:
/* we have received data here */
{
- curl_socket_t s;
+ curl_socket_t s = CURL_SOCKET_BAD;
socklen_t size = (socklen_t) sizeof(struct sockaddr_in);
struct sockaddr_in add;
- getsockname(sock, (struct sockaddr *) &add, &size);
- s=accept(sock, (struct sockaddr *) &add, &size);
+ if(0 == getsockname(sock, (struct sockaddr *) &add, &size))
+ s=accept(sock, (struct sockaddr *) &add, &size);
sclose(sock); /* close the first socket */