aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-03-23 14:43:42 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-03-23 14:43:42 +0000
commit1f61e7f8f4df121ca2695870d800f726db4dbb31 (patch)
tree598689da19fc9492f3f6c7fbb6bc2f9a3999c534
parent1a5f190e4736ea974c53ae286433036f1b796ee2 (diff)
If localbind fails, provide a more portable error message.
-rw-r--r--lib/connect.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 1b57e3fec..adeadb59f 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -295,10 +295,10 @@ static CURLcode bindlocal(struct connectdata *conn,
if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE,
data->set.device, strlen(data->set.device)+1) != 0) {
/* printf("Failed to BINDTODEVICE, socket: %d device: %s error: %s\n",
- sockfd, data->set.device, strerror(errno)); */
+ sockfd, data->set.device, strerror(Curl_ourerrno())); */
infof(data, "SO_BINDTODEVICE %s failed\n",
data->set.device);
- /* This is typiclally "errno 1, error: Operation not permitted" if
+ /* This is typically "errno 1, error: Operation not permitted" if
you're not running as root or another suitable privileged user */
}
}
@@ -353,34 +353,35 @@ static CURLcode bindlocal(struct connectdata *conn,
}
#endif
if(!bindworked) {
+ int err = Curl_ourerrno();
switch(errno) {
case EBADF:
- failf(data, "Invalid descriptor: %d", errno);
+ failf(data, "Invalid descriptor: %d", err);
break;
case EINVAL:
- failf(data, "Invalid request: %d", errno);
+ failf(data, "Invalid request: %d", err);
break;
case EACCES:
- failf(data, "Address is protected, user not superuser: %d", errno);
+ failf(data, "Address is protected, user not superuser: %d", err);
break;
case ENOTSOCK:
failf(data,
"Argument is a descriptor for a file, not a socket: %d",
- errno);
+ err);
break;
case EFAULT:
- failf(data, "Inaccessable memory error: %d", errno);
+ failf(data, "Inaccessable memory error: %d", err);
break;
case ENAMETOOLONG:
- failf(data, "Address too long: %d", errno);
+ failf(data, "Address too long: %d", err);
break;
case ENOMEM:
- failf(data, "Insufficient kernel memory was available: %d", errno);
+ failf(data, "Insufficient kernel memory was available: %d", err);
break;
default:
- failf(data, "errno %d", errno);
+ failf(data, "errno %d", err);
break;
- } /* end of switch(errno) */
+ } /* end of switch(err) */
return CURLE_HTTP_PORT_FAILED;
} /* end of else */