]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/asio/local/detail/impl/endpoint.ipp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / local / detail / impl / endpoint.ipp
index 5ef6b89089702ae106c7b5160fb25cbb613a208f..49f8ac7bdb1d64986b9b6cfcb1067d8f2eb9fd66 100644 (file)
@@ -2,7 +2,7 @@
 // local/detail/impl/endpoint.hpp
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 // Derived from a public domain implementation written by Daniel Casimiro.
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -113,17 +113,12 @@ void endpoint::init(const char* path_name, std::size_t path_length)
     boost::asio::detail::throw_error(ec);
   }
 
-  using namespace std; // For memcpy.
-  data_.local = boost::asio::detail::sockaddr_un_type();
+  using namespace std; // For memset and memcpy.
+  memset(&data_.local, 0, sizeof(boost::asio::detail::sockaddr_un_type));
   data_.local.sun_family = AF_UNIX;
   if (path_length > 0)
     memcpy(data_.local.sun_path, path_name, path_length);
   path_length_ = path_length;
-
-  // NUL-terminate normal path names. Names that start with a NUL are in the
-  // UNIX domain protocol's "abstract namespace" and are not NUL-terminated.
-  if (path_length > 0 && data_.local.sun_path[0] == 0)
-    data_.local.sun_path[path_length] = 0;
 }
 
 } // namespace detail