diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-03-09 22:52:50 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-03-09 22:52:50 +0000 |
commit | ce5805a955c5a79d85792caad47594987f0e0b26 (patch) | |
tree | e22b4801edb6a5448aa38730d311ccace9eb2be3 /lib/ftp.c | |
parent | dad0715d7907e8a64f2cccf1d21b648018f11f41 (diff) |
Use curl_socket_t instead of int for holding sockets. The typedefs and
defines are in setup.h.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r-- | lib/ftp.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -132,7 +132,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn) fd_set rdset; struct timeval dt; struct SessionHandle *data = conn->data; - int sock = conn->sock[SECONDARYSOCKET]; + curl_socket_t sock = conn->sock[SECONDARYSOCKET]; struct timeval now = Curl_tvnow(); long timespent = Curl_tvdiff(Curl_tvnow(), now)/1000; long timeout = data->set.connecttimeout?data->set.connecttimeout: @@ -211,7 +211,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ * Alas, read as much as possible, split up into lines, use the ending * line in a response or continue reading. */ - int sockfd = conn->sock[FIRSTSOCKET]; + curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; int perline; /* count bytes per line */ bool keepon=TRUE; ssize_t gotbytes; @@ -1103,7 +1103,7 @@ static CURLcode ftp_use_port(struct connectdata *conn) { struct SessionHandle *data=conn->data; - int portsock=-1; + curl_socket_t portsock= CURL_SOCKET_BAD; ssize_t nread; int ftpcode; /* receive FTP response codes in this */ CURLcode result; @@ -1166,7 +1166,7 @@ CURLcode ftp_use_port(struct connectdata *conn) return CURLE_FTP_PORT_FAILED; } - portsock = -1; + portsock = CURL_SOCKET_BAD; for (ai = res; ai; ai = ai->ai_next) { /* * Workaround for AIX5 getaddrinfo() problem (it doesn't set ai_socktype): @@ -1175,25 +1175,25 @@ CURLcode ftp_use_port(struct connectdata *conn) ai->ai_socktype = hints.ai_socktype; portsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); - if (portsock < 0) + if (portsock == CURL_SOCKET_BAD) continue; if (bind(portsock, ai->ai_addr, ai->ai_addrlen) < 0) { sclose(portsock); - portsock = -1; + portsock = CURL_SOCKET_BAD; continue; } if (listen(portsock, 1) < 0) { sclose(portsock); - portsock = -1; + portsock = CURL_SOCKET_BAD; continue; } break; } freeaddrinfo(res); - if (portsock < 0) { + if (portsock == CURL_SOCKET_BAD) { failf(data, "%s", strerror(errno)); return CURLE_FTP_PORT_FAILED; } @@ -1378,7 +1378,7 @@ CURLcode ftp_use_port(struct connectdata *conn) Curl_resolv_unlock(data, h); if ( h || sa_filled_in) { - if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) { + if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) != CURL_SOCKET_BAD ) { int size; /* we set the secondary socket variable to this for now, it |