mirror of
https://github.com/curl/curl.git
synced 2026-07-26 09:47:18 +03:00
tool_doswin: avoid Windowsisms in socket code (cont.)
For general readability. Also to match the rest of the source code. - bump `send()` result type from `int` to `ssize_t`. - fix an `int` to be `curl_socklen_t`. - `.S_un.S_addr` -> `.s_addr`. - `SD_RECEIVE` -> `SHUT_RD`. - `SD_SEND` -> `SHUT_WR`. Follow-up toa81ab3e6db#20452 Follow-up to9a2663322c#17572 Closes #20457
This commit is contained in:
parent
fb44e44d92
commit
a4e2232c43
1 changed files with 6 additions and 5 deletions
|
|
@ -708,7 +708,7 @@ static DWORD WINAPI win_stdin_thread_func(void *thread_data)
|
|||
{
|
||||
struct win_thread_data *tdata = (struct win_thread_data *)thread_data;
|
||||
DWORD n;
|
||||
int nwritten;
|
||||
ssize_t nwritten;
|
||||
char buffer[BUFSIZ];
|
||||
BOOL r;
|
||||
|
||||
|
|
@ -726,7 +726,7 @@ static DWORD WINAPI win_stdin_thread_func(void *thread_data)
|
|||
|
||||
sclose(tdata->socket_l);
|
||||
tdata->socket_l = CURL_SOCKET_BAD;
|
||||
if(shutdown(socket_w, SD_RECEIVE)) {
|
||||
if(shutdown(socket_w, SHUT_RD)) {
|
||||
errorf("shutdown error: %d", SOCKERRNO);
|
||||
goto ThreadCleanup;
|
||||
}
|
||||
|
|
@ -760,7 +760,8 @@ ThreadCleanup:
|
|||
curl_socket_t win32_stdin_read_thread(void)
|
||||
{
|
||||
bool r;
|
||||
int rc = 0, socksize = 0;
|
||||
int rc = 0;
|
||||
curl_socklen_t socksize = 0;
|
||||
struct win_thread_data *tdata = NULL;
|
||||
struct sockaddr_in selfaddr;
|
||||
static HANDLE stdin_thread = NULL;
|
||||
|
|
@ -791,7 +792,7 @@ curl_socket_t win32_stdin_read_thread(void)
|
|||
socksize = sizeof(selfaddr);
|
||||
memset(&selfaddr, 0, socksize);
|
||||
selfaddr.sin_family = AF_INET;
|
||||
selfaddr.sin_addr.S_un.S_addr = htonl(INADDR_LOOPBACK);
|
||||
selfaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
/* Bind to any available loopback port */
|
||||
if(bind(tdata->socket_l, (const struct sockaddr *)&selfaddr, socksize)) {
|
||||
errorf("bind error: %d", SOCKERRNO);
|
||||
|
|
@ -846,7 +847,7 @@ curl_socket_t win32_stdin_read_thread(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if(shutdown(socket_r, SD_SEND)) {
|
||||
if(shutdown(socket_r, SHUT_WR)) {
|
||||
errorf("shutdown error: %d", SOCKERRNO);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue