mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
Kernel: Make sure OpenFileDescription is kept alive while read() blocks
It's not safe to store OpenFileDescription in a raw pointer when blocking, since another thread may decide to close the corresponding file descriptor.
This commit is contained in:
parent
401c9415b4
commit
f99af1bef0
1 changed files with 1 additions and 1 deletions
|
@ -12,7 +12,7 @@ namespace Kernel {
|
||||||
|
|
||||||
using BlockFlags = Thread::FileBlocker::BlockFlags;
|
using BlockFlags = Thread::FileBlocker::BlockFlags;
|
||||||
|
|
||||||
static ErrorOr<OpenFileDescription*> open_readable_file_description(Process::OpenFileDescriptions const& fds, int fd)
|
static ErrorOr<NonnullRefPtr<OpenFileDescription>> open_readable_file_description(Process::OpenFileDescriptions const& fds, int fd)
|
||||||
{
|
{
|
||||||
auto description = TRY(fds.open_file_description(fd));
|
auto description = TRY(fds.open_file_description(fd));
|
||||||
if (!description->is_readable())
|
if (!description->is_readable())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue