posix os_socket_accept: stop assuming socklen_t is unsigned int (#4488)

This commit is contained in:
YAMAMOTO Takashi 2025-07-17 09:04:13 +09:00 committed by GitHub
parent db942f3aaf
commit 46d4e248bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -220,12 +220,17 @@ int
os_socket_accept(bh_socket_t server_sock, bh_socket_t *sock, void *addr,
unsigned int *addrlen)
{
*sock = accept(server_sock, addr, addrlen);
if (addr == NULL) {
*sock = accept(server_sock, NULL, NULL);
}
else {
socklen_t len = *addrlen;
*sock = accept(server_sock, addr, &len);
*addrlen = len;
}
if (*sock < 0) {
return BHT_ERROR;
}
return BHT_OK;
}