Fix clang-analyzer-unix.StdCLibraryFunctions

```
/home/chiller/Desktop/git/ddnet/src/base/system.cpp:1989:10: error: The 1st argument to 'connect' is < 0 but should be >= 0 [clang-analyzer-unix.StdCLibraryFunctions,-warnings-as-errors]
 1989 |                 return connect(sock->ipv4sock, (struct sockaddr *)&addr, sizeof(addr));
      |                        ^
```
This commit is contained in:
ChillerDragon 2024-05-11 13:58:23 +08:00
parent 64505273a9
commit 59cb7ef5a9

View file

@ -1987,6 +1987,8 @@ int net_tcp_connect(NETSOCKET sock, const NETADDR *a)
{
struct sockaddr_in addr;
netaddr_to_sockaddr_in(a, &addr);
if(sock->ipv4sock < 0)
return -2;
return connect(sock->ipv4sock, (struct sockaddr *)&addr, sizeof(addr));
}
@ -1994,6 +1996,8 @@ int net_tcp_connect(NETSOCKET sock, const NETADDR *a)
{
struct sockaddr_in6 addr;
netaddr_to_sockaddr_in6(a, &addr);
if(sock->ipv6sock < 0)
return -2;
return connect(sock->ipv6sock, (struct sockaddr *)&addr, sizeof(addr));
}