[lldb] Fix DomainSocket::GetSocketName for unnamed sockets
authorPavel Labath <pavel@labath.sk>
Thu, 23 Sep 2021 09:31:33 +0000 (11:31 +0200)
committerPavel Labath <pavel@labath.sk>
Thu, 23 Sep 2021 10:30:18 +0000 (12:30 +0200)
commit5685eb950da7c6901c8b264a3c93e8ea63b34d3d
treeb450f3a3a02762f7d71b34208f1b77cd6bc1ce63
parente7c879a69d6b61f35969936a9efd46bcfbf80ca0
[lldb] Fix DomainSocket::GetSocketName for unnamed sockets

getpeername will return addrlen = 2 (sizeof sa_family_t) for unnamed
sockets (those not assigned a name with bind(2)). This is typically true
for client sockets as well as those created by socketpair(2).

This GetSocketName used to crash for sockets which were connected to
these kinds of sockets. Now it returns an empty string.
lldb/source/Host/posix/DomainSocket.cpp
lldb/unittests/Host/SocketTest.cpp