mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:08:11 +00:00
Kernel: Make custody_for_dirfd() fail on files other than directories
This commit is contained in:
parent
41f5598516
commit
f0c9c5e076
1 changed files with 5 additions and 4 deletions
|
@ -1084,11 +1084,12 @@ ErrorOr<NonnullRefPtr<Custody>> Process::custody_for_dirfd(int dirfd)
|
|||
{
|
||||
if (dirfd == AT_FDCWD)
|
||||
return current_directory();
|
||||
|
||||
auto base_description = TRY(open_file_description(dirfd));
|
||||
if (!base_description->custody())
|
||||
auto description = TRY(open_file_description(dirfd));
|
||||
if (!description->custody())
|
||||
return EINVAL;
|
||||
return *base_description->custody();
|
||||
if (!description->is_directory())
|
||||
return ENOTDIR;
|
||||
return *description->custody();
|
||||
}
|
||||
|
||||
SpinlockProtected<NonnullOwnPtr<KString>, LockRank::None> const& Process::name() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue