mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 05:25:13 +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
Notes:
sideshowbarker
2024-07-18 00:53:42 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f99af1bef00
1 changed files with 1 additions and 1 deletions
|
@ -12,7 +12,7 @@ namespace Kernel {
|
|||
|
||||
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));
|
||||
if (!description->is_readable())
|
||||
|
|
Loading…
Add table
Reference in a new issue