fix compiler warning
This commit is contained in:
Родитель
2ecf22e37e
Коммит
a754ea1326
|
@ -299,6 +299,7 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||||
/* how many port numbers to try to bind to, increasing one at a time */
|
/* how many port numbers to try to bind to, increasing one at a time */
|
||||||
int portnum = data->set.localportrange;
|
int portnum = data->set.localportrange;
|
||||||
const char *dev = data->set.str[STRING_DEVICE];
|
const char *dev = data->set.str[STRING_DEVICE];
|
||||||
|
int error;
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* Select device to bind socket to
|
* Select device to bind socket to
|
||||||
|
@ -358,7 +359,9 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||||
hostent_buf,
|
hostent_buf,
|
||||||
sizeof(hostent_buf));
|
sizeof(hostent_buf));
|
||||||
*/
|
*/
|
||||||
failf(data, "Couldn't bind to '%s'", dev);
|
data->state.os_errno = error = SOCKERRNO;
|
||||||
|
failf(data, "Couldn't bind to '%s', failed with errno %d: %s",
|
||||||
|
dev, error, Curl_strerror(conn, error));
|
||||||
if(h)
|
if(h)
|
||||||
Curl_resolv_unlock(data, h);
|
Curl_resolv_unlock(data, h);
|
||||||
return CURLE_INTERFACE_FAILED;
|
return CURLE_INTERFACE_FAILED;
|
||||||
|
@ -384,9 +387,7 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||||
*/
|
*/
|
||||||
if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
|
if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
|
||||||
dev, strlen(dev)+1) != 0) {
|
dev, strlen(dev)+1) != 0) {
|
||||||
/* printf("Failed to BINDTODEVICE, socket: %d device: %s error: %s\n",
|
error = ERRNO;
|
||||||
sockfd, dev, Curl_strerror(SOCKERRNO)); */
|
|
||||||
int error = ERRNO;
|
|
||||||
infof(data, "SO_BINDTODEVICE %s failed with errno %d: %s; will do regular bind\n",
|
infof(data, "SO_BINDTODEVICE %s failed with errno %d: %s; will do regular bind\n",
|
||||||
dev, error, Curl_strerror(conn, error));
|
dev, error, Curl_strerror(conn, error));
|
||||||
/* This is typically "errno 1, error: Operation not permitted" if
|
/* This is typically "errno 1, error: Operation not permitted" if
|
||||||
|
@ -437,7 +438,9 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||||
struct Curl_sockaddr_storage add;
|
struct Curl_sockaddr_storage add;
|
||||||
socklen_t size = sizeof(add);
|
socklen_t size = sizeof(add);
|
||||||
if(getsockname(sockfd, (struct sockaddr *) &add, &size) < 0) {
|
if(getsockname(sockfd, (struct sockaddr *) &add, &size) < 0) {
|
||||||
failf(data, "getsockname() failed");
|
data->state.os_errno = error = SOCKERRNO;
|
||||||
|
failf(data, "getsockname() failed with errno %d: %s",
|
||||||
|
error, Curl_strerror(conn, error));
|
||||||
if(h)
|
if(h)
|
||||||
Curl_resolv_unlock(data, h);
|
Curl_resolv_unlock(data, h);
|
||||||
return CURLE_INTERFACE_FAILED;
|
return CURLE_INTERFACE_FAILED;
|
||||||
|
@ -463,9 +466,9 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||||
break;
|
break;
|
||||||
} while(1);
|
} while(1);
|
||||||
|
|
||||||
data->state.os_errno = SOCKERRNO;
|
data->state.os_errno = error = SOCKERRNO;
|
||||||
failf(data, "bind failure: %s",
|
failf(data, "bind failed with errno %d: %s",
|
||||||
Curl_strerror(conn, data->state.os_errno));
|
error, Curl_strerror(conn, error));
|
||||||
if(h)
|
if(h)
|
||||||
Curl_resolv_unlock(data, h);
|
Curl_resolv_unlock(data, h);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче