diff options
author | Yang Tse <yangsita@gmail.com> | 2008-10-11 15:32:32 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2008-10-11 15:32:32 +0000 |
commit | a754ea1326ea7f6fa099fa5c0c10d06e6e28eda3 (patch) | |
tree | ab37aa6accfc2f108e55ff4077cfb75b0d09e4a6 | |
parent | 2ecf22e37ee08a3b7421e2ca49ad45a2e5299e28 (diff) |
fix compiler warning
-rw-r--r-- | lib/connect.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/connect.c b/lib/connect.c index 3d3479218..51857ec8d 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -299,6 +299,7 @@ static CURLcode bindlocal(struct connectdata *conn, /* how many port numbers to try to bind to, increasing one at a time */ int portnum = data->set.localportrange; const char *dev = data->set.str[STRING_DEVICE]; + int error; /************************************************************* * Select device to bind socket to @@ -358,7 +359,9 @@ static CURLcode bindlocal(struct connectdata *conn, 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) Curl_resolv_unlock(data, h); return CURLE_INTERFACE_FAILED; @@ -384,9 +387,7 @@ static CURLcode bindlocal(struct connectdata *conn, */ if(setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev)+1) != 0) { - /* printf("Failed to BINDTODEVICE, socket: %d device: %s error: %s\n", - sockfd, dev, Curl_strerror(SOCKERRNO)); */ - int error = ERRNO; + error = ERRNO; infof(data, "SO_BINDTODEVICE %s failed with errno %d: %s; will do regular bind\n", dev, error, Curl_strerror(conn, error)); /* 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; socklen_t size = sizeof(add); 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) Curl_resolv_unlock(data, h); return CURLE_INTERFACE_FAILED; @@ -463,9 +466,9 @@ static CURLcode bindlocal(struct connectdata *conn, break; } while(1); - data->state.os_errno = SOCKERRNO; - failf(data, "bind failure: %s", - Curl_strerror(conn, data->state.os_errno)); + data->state.os_errno = error = SOCKERRNO; + failf(data, "bind failed with errno %d: %s", + error, Curl_strerror(conn, error)); if(h) Curl_resolv_unlock(data, h); |