1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 01:15:07 +00:00

Kernel: Allow File::close() to fail

And pass the result through to sys$close() return value.

Fixes https://github.com/SerenityOS/serenity/issues/427
This commit is contained in:
Sergey Bugaev 2020-06-02 19:20:05 +03:00 committed by Andreas Kling
parent d4ddb0013c
commit 1b4e88fb59
12 changed files with 23 additions and 15 deletions

View file

@ -440,9 +440,9 @@ void TCPSocket::shut_down_for_writing()
}
}
void TCPSocket::close()
KResult TCPSocket::close()
{
IPv4Socket::close();
auto result = IPv4Socket::close();
if (state() == State::CloseWait) {
#ifdef TCP_SOCKET_DEBUG
dbg() << " Sending FIN from CloseWait and moving into LastAck";
@ -453,6 +453,7 @@ void TCPSocket::close()
LOCKER(closing_sockets().lock());
closing_sockets().resource().set(tuple(), *this);
return result;
}
}