mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
Kernel: Support chdir() to a directory that's executable but not readable.
Also the superuser should be allowed to resolve any possible path without getting tripped up by EACCES.
This commit is contained in:
parent
4f9b6a88a6
commit
f75eb9af16
Notes:
sideshowbarker
2024-07-19 15:34:21 +09:00
Author: https://github.com/awesomekling
Commit: f75eb9af16
3 changed files with 19 additions and 8 deletions
|
@ -1273,13 +1273,10 @@ int Process::sys$chdir(const char* path)
|
|||
{
|
||||
if (!validate_read_str(path))
|
||||
return -EFAULT;
|
||||
int error;
|
||||
auto descriptor = VFS::the().open(path, error, 0, 0, cwd_inode());
|
||||
if (!descriptor)
|
||||
return error;
|
||||
if (!descriptor->is_directory())
|
||||
return -ENOTDIR;
|
||||
m_cwd = descriptor->inode();
|
||||
auto directory_or_error = VFS::the().open_directory(String(path), cwd_inode());
|
||||
if (directory_or_error.is_error())
|
||||
return directory_or_error.error();
|
||||
m_cwd = *directory_or_error.value();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue