lib: introduce `CURL_ACCEPT()`
No binary (build failed)
—
(log yok)
| @@ -2116,7 +2116,7 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf, | |
| s_accepted = accept4(ctx->sock, (struct sockaddr *) &add, &size, | |
| SOCK_NONBLOCK | SOCK_CLOEXEC); | |
| #else | |
| - | s_accepted = accept(ctx->sock, (struct sockaddr *) &add, &size); |
| + | s_accepted = CURL_ACCEPT(ctx->sock, (struct sockaddr *) &add, &size); |
| #endif | |
| } | |
| @@ -37,7 +37,6 @@ | |
| #endif | |
| #undef socket | |
| - | #undef accept |
| #ifdef HAVE_ACCEPT4 | |
| #undef accept4 | |
| #endif | |
| @@ -1084,6 +1084,9 @@ CURL_EXTERN ALLOC_FUNC | |
| #define CURL_FREEADDRINFO(data) \ | |
| curl_dbg_freeaddrinfo(data, __LINE__, __FILE__) | |
| + | #define CURL_ACCEPT(sock,addr,len) \ |
| + | curl_dbg_accept(sock, addr, len, __LINE__, __FILE__) |
| + | |
| #else /* !CURLDEBUG */ | |
| #define sclose(x) CURL_SCLOSE(x) | |
| @@ -1092,6 +1095,8 @@ CURL_EXTERN ALLOC_FUNC | |
| #define CURL_GETADDRINFO getaddrinfo | |
| #define CURL_FREEADDRINFO freeaddrinfo | |
| + | #define CURL_ACCEPT accept |
| + | |
| #endif /* CURLDEBUG */ | |
| /* Some versions of the Android NDK is missing the declaration */ | |
| @@ -371,7 +371,7 @@ curl_socket_t curl_dbg_accept(curl_socket_t s, void *saddr, void *saddrlen, | |
| struct sockaddr *addr = (struct sockaddr *)saddr; | |
| curl_socklen_t *addrlen = (curl_socklen_t *)saddrlen; | |
| - | curl_socket_t sockfd = (accept)(s, addr, addrlen); |
| + | curl_socket_t sockfd = accept(s, addr, addrlen); |
| if(source && (sockfd != CURL_SOCKET_BAD)) | |
| curl_dbg_log("FD %s:%d accept() = %" FMT_SOCKET_T "\n", | |
| @@ -59,9 +59,6 @@ | |
| #undef socket | |
| #define socket(domain,type,protocol) \ | |
| curl_dbg_socket((int)domain, type, protocol, __LINE__, __FILE__) | |
| - | #undef accept /* for those with accept as a macro */ |
| - | #define accept(sock,addr,len) \ |
| - | curl_dbg_accept(sock, addr, len, __LINE__, __FILE__) |
| #ifdef HAVE_ACCEPT4 | |
| #undef accept4 /* for those with accept4 as a macro */ | |
| #define accept4(sock,addr,len,flags) \ | |
| @@ -201,7 +201,7 @@ int Curl_socketpair(int domain, int type, int protocol, | |
| pfd[0].events = POLLIN; | |
| pfd[0].revents = 0; | |
| (void)Curl_poll(pfd, 1, 1000); /* one second */ | |
| - | socks[1] = accept(listener, NULL, NULL); |
| + | socks[1] = CURL_ACCEPT(listener, NULL, NULL); |
| if(socks[1] == CURL_SOCKET_BAD) | |
| goto error; | |
| else { | |
| @@ -765,8 +765,8 @@ static DWORD WINAPI win_stdin_thread_func(void *thread_data) | |
| SOCKADDR_IN clientAddr; | |
| int clientAddrLen = sizeof(clientAddr); | |
| - | curl_socket_t socket_w = accept(tdata->socket_l, (SOCKADDR*)&clientAddr, |
| - | &clientAddrLen); |
| + | curl_socket_t socket_w = CURL_ACCEPT(tdata->socket_l, (SOCKADDR*)&clientAddr, |
| + | &clientAddrLen); |
| if(socket_w == CURL_SOCKET_BAD) { | |
| errorf("accept error: %08lx", GetLastError()); | |