// 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
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