mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
FileSystem: Only retrieve inode metadata once in VFS::chown().
This commit is contained in:
parent
1876606973
commit
aa35c08633
Notes:
sideshowbarker
2024-07-19 13:47:15 +09:00
Author: https://github.com/awesomekling
Commit: aa35c08633
1 changed files with 5 additions and 3 deletions
|
@ -413,11 +413,13 @@ KResult VFS::chown(StringView path, uid_t a_uid, gid_t a_gid, Custody& base)
|
|||
if (inode.fs().is_readonly())
|
||||
return KResult(-EROFS);
|
||||
|
||||
if (current->process().euid() != inode.metadata().uid && !current->process().is_superuser())
|
||||
auto metadata = inode.metadata();
|
||||
|
||||
if (current->process().euid() != metadata.uid && !current->process().is_superuser())
|
||||
return KResult(-EPERM);
|
||||
|
||||
uid_t new_uid = inode.metadata().uid;
|
||||
gid_t new_gid = inode.metadata().gid;
|
||||
uid_t new_uid = metadata.uid;
|
||||
gid_t new_gid = metadata.gid;
|
||||
|
||||
if (a_uid != (uid_t)-1) {
|
||||
if (current->process().euid() != a_uid && !current->process().is_superuser())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue