diff options
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/ServerSocket.cxx | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index b1cffcfda..7e279dada 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -429,21 +429,12 @@ bool ServerSocket::AddPath(AllocatedPath &&path, Error &error) { #ifdef HAVE_UN - struct sockaddr_un s_un; + (void)error; - const size_t path_length = path.length(); - if (path_length >= sizeof(s_un.sun_path)) { - error.Set(server_socket_domain, - "UNIX socket path is too long"); - return false; - } - - RemoveFile(path); - - s_un.sun_family = AF_UNIX; - memcpy(s_un.sun_path, path.c_str(), path_length + 1); + AllocatedSocketAddress address; + address.SetLocal(path.c_str()); - OneServerSocket &s = AddAddress({(const sockaddr *)&s_un, sizeof(s_un)}); + OneServerSocket &s = AddAddress(std::move(address)); s.SetPath(std::move(path)); return true; |