]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/admin_socket: fix compile error on OSX
authorYan, Zheng <zyan@redhat.com>
Fri, 14 Aug 2015 14:06:11 +0000 (22:06 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 31 Aug 2015 08:00:28 +0000 (16:00 +0800)
Invalid operands to binary expression ('__bind<int &, sockaddr *,
unsigned long>' and 'int')

Without :: clang confuses C bind function and std::bind().

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/common/OutputDataSocket.cc
src/common/admin_socket.cc

index 2c4526ddaf9a98a7279b6b5dca286b689d7917e8..e43f5cf95cb894216c66ae6b4446ef9df617df29 100644 (file)
@@ -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;
       }
index 1df510545137361dd183dfc5284e04361fd95c10..07a2246e9e552479eafe60e69b0ca214fee052de 100644 (file)
@@ -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 {