From: Yan, Zheng Date: Fri, 14 Aug 2015 14:06:11 +0000 (+0800) Subject: common/admin_socket: fix compile error on OSX X-Git-Tag: v9.1.0~259^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8d527d41673e3ec33a003cf0a7155197d492dbe9;p=ceph.git common/admin_socket: fix compile error on OSX Invalid operands to binary expression ('__bind' and 'int') Without :: clang confuses C bind function and std::bind(). Signed-off-by: Yan, Zheng --- diff --git a/src/common/OutputDataSocket.cc b/src/common/OutputDataSocket.cc index 2c4526ddaf9a..e43f5cf95cb8 100644 --- a/src/common/OutputDataSocket.cc +++ b/src/common/OutputDataSocket.cc @@ -179,14 +179,14 @@ std::string OutputDataSocket::bind_and_listen(const std::string &sock_path, int address.sun_family = AF_UNIX; snprintf(address.sun_path, sizeof(address.sun_path), "%s", sock_path.c_str()); - if (bind(sock_fd, (struct sockaddr*)&address, + if (::bind(sock_fd, (struct sockaddr*)&address, sizeof(struct sockaddr_un)) != 0) { int err = errno; if (err == EADDRINUSE) { // The old UNIX domain socket must still be there. // Let's unlink it and try again. VOID_TEMP_FAILURE_RETRY(unlink(sock_path.c_str())); - if (bind(sock_fd, (struct sockaddr*)&address, + if (::bind(sock_fd, (struct sockaddr*)&address, sizeof(struct sockaddr_un)) == 0) { err = 0; } diff --git a/src/common/admin_socket.cc b/src/common/admin_socket.cc index 1df510545137..07a2246e9e55 100644 --- a/src/common/admin_socket.cc +++ b/src/common/admin_socket.cc @@ -209,7 +209,7 @@ std::string AdminSocket::bind_and_listen(const std::string &sock_path, int *fd) address.sun_family = AF_UNIX; snprintf(address.sun_path, sizeof(address.sun_path), "%s", sock_path.c_str()); - if (bind(sock_fd, (struct sockaddr*)&address, + if (::bind(sock_fd, (struct sockaddr*)&address, sizeof(struct sockaddr_un)) != 0) { int err = errno; if (err == EADDRINUSE) { @@ -222,7 +222,7 @@ std::string AdminSocket::bind_and_listen(const std::string &sock_path, int *fd) } else { ldout(m_cct, 20) << "unlink stale file " << sock_path << dendl; VOID_TEMP_FAILURE_RETRY(unlink(sock_path.c_str())); - if (bind(sock_fd, (struct sockaddr*)&address, + if (::bind(sock_fd, (struct sockaddr*)&address, sizeof(struct sockaddr_un)) == 0) { err = 0; } else {