From 0596ab880e47d77b2a5e29b369e2e634eb213091 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 9 Jan 2020 21:30:56 +0100 Subject: [PATCH] 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(). --- Kernel/Net/LocalSocket.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 01782d67626..4cb81da30e6 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -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(address); char safe_address[sizeof(local_address.sun_path) + 1] = { 0 };