add ability to run with asan on macOS
This commit is contained in:
parent
f5efd41dc1
commit
bee8a99a34
@ -71,8 +71,14 @@ namespace ix
|
|||||||
|
|
||||||
int getAnyFreePort()
|
int getAnyFreePort()
|
||||||
{
|
{
|
||||||
|
// ASAN complains about getsockname
|
||||||
|
#if defined(__has_feature)
|
||||||
|
# if __has_feature(address_sanitizer)
|
||||||
|
static int defaultPort = 8090;
|
||||||
|
return defaultPort++;
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
int defaultPort = 8090;
|
int defaultPort = 8090;
|
||||||
|
|
||||||
int sockfd;
|
int sockfd;
|
||||||
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||||
{
|
{
|
||||||
@ -116,6 +122,7 @@ namespace ix
|
|||||||
::close(sockfd);
|
::close(sockfd);
|
||||||
|
|
||||||
return port;
|
return port;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int getFreePort()
|
int getFreePort()
|
||||||
|
Loading…
Reference in New Issue
Block a user