AbstractSocket: do not bind AF_LOCAL socket when connecting

Fix connection error for AF_LOCAL sockets.

Change-Id: I2e822f34e64434ccdbdd484f1647de2a8a6232d7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7166
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
X512 2023-12-01 06:50:41 +09:00 committed by waddlesplash
parent 5014ac9392
commit 33365c2a0d

View File

@ -223,9 +223,10 @@ BAbstractSocket::Connect(const BNetworkAddress& peer, int type,
fInitStatus = SetTimeout(timeout);
if (fInitStatus == B_OK && !IsBound()) {
// Bind to ADDR_ANY, if the address family supports it
BNetworkAddress local;
local.SetToWildcard(peer.Family());
fInitStatus = Bind(local, true);
if (local.SetToWildcard(peer.Family()) == B_OK)
fInitStatus = Bind(local, true);
}
if (fInitStatus != B_OK)
return fInitStatus;