mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
Compat work towards porting vim.
This commit is contained in:
parent
2e5b9d318f
commit
a356746d04
Notes:
sideshowbarker
2024-07-19 15:37:10 +09:00
Author: https://github.com/awesomekling
Commit: a356746d04
17 changed files with 200 additions and 77 deletions
|
@ -268,6 +268,28 @@ KResult VFS::mkdir(const String& path, mode_t mode, Inode& base)
|
|||
return KResult(error);
|
||||
}
|
||||
|
||||
KResult VFS::access(const String& path, int mode, Inode& base)
|
||||
{
|
||||
auto inode_or_error = resolve_path_to_inode(path, base);
|
||||
if (inode_or_error.is_error())
|
||||
return inode_or_error.error();
|
||||
auto inode = inode_or_error.value();
|
||||
auto metadata = inode->metadata();
|
||||
if (mode & R_OK) {
|
||||
if (!metadata.may_read(*current))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
if (mode & W_OK) {
|
||||
if (!metadata.may_write(*current))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
if (mode & X_OK) {
|
||||
if (!metadata.may_execute(*current))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
KResult VFS::chmod(const String& path, mode_t mode, Inode& base)
|
||||
{
|
||||
auto inode_or_error = resolve_path_to_inode(path, base);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue