Skip to content

Commit

Permalink
Use socklen_t instead of unsigned int in call to accept.
Browse files Browse the repository at this point in the history
Not all platforms define `socklen_t` as `unsigned int`. E.g. Android
defines it as `int`.
  • Loading branch information
iphydf committed Oct 4, 2016
1 parent b8b9789 commit e85ba25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions toxcore/TCP_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ static void do_TCP_accept_new(TCP_Server *TCP_server)

for (i = 0; i < TCP_server->num_listening_socks; ++i) {
struct sockaddr_storage addr;
unsigned int addrlen = sizeof(addr);
socklen_t addrlen = sizeof(addr);
sock_t sock;

do {
Expand Down Expand Up @@ -1323,7 +1323,7 @@ static void do_TCP_epoll(TCP_Server *TCP_server)
case TCP_SOCKET_LISTENING: {
//socket is from socks_listening, accept connection
struct sockaddr_storage addr;
unsigned int addrlen = sizeof(addr);
socklen_t addrlen = sizeof(addr);

while (1) {
sock_t sock_new = accept(sock, (struct sockaddr *)&addr, &addrlen);
Expand Down

0 comments on commit e85ba25

Please sign in to comment.