mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
Kernel: Remove unnecessary TOCTOU bug in sys$pipe()
We don't need to explicitly check for EMFILE conditions before doing anything in sys$pipe(). The fd allocation code will take care of it for us anyway.
This commit is contained in:
parent
2a386c0b50
commit
0b58fd5aef
1 changed files with 1 additions and 3 deletions
|
@ -13,9 +13,7 @@ ErrorOr<FlatPtr> Process::sys$pipe(int pipefd[2], int flags)
|
|||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
||||
TRY(require_promise(Pledge::stdio));
|
||||
auto open_count = fds().with_shared([](auto& fds) { return fds.open_count(); });
|
||||
if (open_count + 2 > OpenFileDescriptions::max_open())
|
||||
return EMFILE;
|
||||
|
||||
// Reject flags other than O_CLOEXEC, O_NONBLOCK
|
||||
if ((flags & (O_CLOEXEC | O_NONBLOCK)) != flags)
|
||||
return EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue