Skip to content

Commit d5cdbe6

Browse files
fix: Specifying the global namespace for bind and connect (#3007)
1 parent 3dd23bc commit d5cdbe6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/butil/endpoint.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ DEFINE_bool(reuse_uds_path, false, "remove unix domain socket file before listen
5252
__BEGIN_DECLS
5353
int BAIDU_WEAK bthread_connect(
5454
int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen) {
55-
return connect(sockfd, serv_addr, addrlen);
55+
return ::connect(sockfd, serv_addr, addrlen);
5656
}
5757

5858
int BAIDU_WEAK bthread_timed_connect(
@@ -577,7 +577,7 @@ int tcp_listen(EndPoint point) {
577577
::unlink(((sockaddr_un*) &serv_addr)->sun_path);
578578
}
579579

580-
if (bind(sockfd, (struct sockaddr*)& serv_addr, serv_addr_size) != 0) {
580+
if (::bind(sockfd, (struct sockaddr*)& serv_addr, serv_addr_size) != 0) {
581581
return -1;
582582
}
583583
if (listen(sockfd, 65535) != 0) {

0 commit comments

Comments
 (0)