mirror of https://github.com/moparisthebest/curl
fix errno usage for WIN32 builds
This commit is contained in:
parent
4d19ebe738
commit
4ee4e66c4f
|
@ -876,14 +876,15 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
|
||||||
/* Try binding the given address. */
|
/* Try binding the given address. */
|
||||||
if(bind(portsock, sa, sslen) ) {
|
if(bind(portsock, sa, sslen) ) {
|
||||||
/* It failed. */
|
/* It failed. */
|
||||||
if(errno == EADDRNOTAVAIL) {
|
error = SOCKERRNO;
|
||||||
|
if(error == EADDRNOTAVAIL) {
|
||||||
|
|
||||||
/* The requested bind address is not local
|
/* The requested bind address is not local
|
||||||
* use the address used forthe control connection instead
|
* use the address used forthe control connection instead
|
||||||
* restart the port loop
|
* restart the port loop
|
||||||
*/
|
*/
|
||||||
failf(data, "bind(port=%i) failed: %s", port,
|
failf(data, "bind(port=%i) failed: %s", port,
|
||||||
Curl_strerror(conn, SOCKERRNO) );
|
Curl_strerror(conn, error) );
|
||||||
|
|
||||||
sslen = sizeof(ss);
|
sslen = sizeof(ss);
|
||||||
if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) {
|
if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) {
|
||||||
|
@ -895,9 +896,9 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
|
||||||
port = port_min;
|
port = port_min;
|
||||||
continue;
|
continue;
|
||||||
}else
|
}else
|
||||||
if(errno != EADDRINUSE && errno != EACCES) {
|
if(error != EADDRINUSE && error != EACCES) {
|
||||||
failf(data, "bind(port=%i) failed: %s", port,
|
failf(data, "bind(port=%i) failed: %s", port,
|
||||||
Curl_strerror(conn, SOCKERRNO) );
|
Curl_strerror(conn, error) );
|
||||||
sclose(portsock);
|
sclose(portsock);
|
||||||
return CURLE_FTP_PORT_FAILED;
|
return CURLE_FTP_PORT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue