[lldb] Fix SocketTest.DomainGetConnectURI on macOS by stripping more zeroes from getpeername result
Apparently macOS is padding the name result with several padding zeroes at the end. Just strip them all to pretend it's a C-string. Thanks to Pavel for suggesting this fix.
This commit is contained in:
parent
7664508910
commit
be2a4216fc
|
|
@ -143,8 +143,7 @@ std::string DomainSocket::GetSocketName() const {
|
|||
llvm::StringRef name(saddr_un.sun_path + GetNameOffset(),
|
||||
sock_addr_len - offsetof(struct sockaddr_un, sun_path) -
|
||||
GetNameOffset());
|
||||
if (name.back() == '\0')
|
||||
name = name.drop_back();
|
||||
name = name.drop_while([](char c) { return c == '\0'; });
|
||||
|
||||
return name.str();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue