Kernel: connect() should EISCONN on already-connected LocalSocket

This was causing us to try and accept the same client socket multiple
times on the server side, tripping an assertion in Socket::accept().
This commit is contained in:
Andreas Kling 2020-01-09 21:30:56 +01:00
parent 21517f693d
commit 0596ab880e
Notes: sideshowbarker 2024-07-19 10:14:30 +09:00

View File

@ -105,6 +105,8 @@ KResult LocalSocket::connect(FileDescription& description, const sockaddr* addre
return KResult(-EINVAL);
if (address->sa_family != AF_LOCAL)
return KResult(-EINVAL);
if (is_connected())
return KResult(-EISCONN);
const sockaddr_un& local_address = *reinterpret_cast<const sockaddr_un*>(address);
char safe_address[sizeof(local_address.sun_path) + 1] = { 0 };