1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

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
parent 6634da31d9
commit 625ab1f527
2 changed files with 13 additions and 5 deletions

View file

@ -117,10 +117,14 @@ KResult LocalSocket::bind(const sockaddr* user_address, socklen_t address_size)
return KResult(-EADDRINUSE);
return result.error();
}
m_file = move(result.value());
ASSERT(m_file->inode());
m_file->inode()->bind_socket(*this);
auto file = move(result.value());
ASSERT(file->inode());
if (!file->inode()->bind_socket(*this))
return KResult(-EADDRINUSE);
m_file = move(file);
m_address = address;
m_bound = true;