mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 12:18:25 +00:00
Kernel: Make custody_for_dirfd() fail on files other than directories
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user