mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
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:
parent
64505273a9
commit
59cb7ef5a9
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue