Kernel: LocalSocket should fail with EADDRINUSE for already-bound files

This commit is contained in:
Andreas Kling 2020-01-30 22:15:45 +01:00
commit 625ab1f527
Notes: sideshowbarker 2024-07-19 09:44:44 +09:00
2 changed files with 13 additions and 5 deletions

View file

@ -168,14 +168,18 @@ void Inode::set_vmobject(VMObject& vmobject)
bool Inode::bind_socket(LocalSocket& socket)
{
ASSERT(!m_socket);
LOCKER(m_lock);
if (m_socket)
return false;
m_socket = socket;
return true;
}
bool Inode::unbind_socket()
{
ASSERT(m_socket);
LOCKER(m_lock);
if (!m_socket)
return false;
m_socket = nullptr;
return true;
}