mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
If localbind fails, provide a more portable error message.
This commit is contained in:
parent
1a5f190e47
commit
1f61e7f8f4
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user