1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

Net: Add LocalSocket::socket_path()

This is a little utility function to safely extract the path without
manually dealing with sun_path and null-termination.
This commit is contained in:
Sergey Bugaev 2019-08-10 18:55:54 +03:00 committed by Andreas Kling
parent 8a975ff630
commit a30930465e
2 changed files with 8 additions and 0 deletions

View file

@ -227,3 +227,9 @@ ssize_t LocalSocket::recvfrom(FileDescription& description, void* buffer, size_t
}
ASSERT_NOT_REACHED();
}
StringView LocalSocket::socket_path() const
{
int len = strnlen(m_address.sun_path, sizeof(m_address.sun_path));
return { m_address.sun_path, len };
}