1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 09:44:58 +00:00

Kernel: The superuser is allowed to utime() on any file

Before this patch, root was not able to "touch" someone else's file.
This commit is contained in:
Andreas Kling 2020-01-03 04:14:41 +01:00
parent 3f74e66e82
commit 889ecd1375

View file

@ -163,7 +163,7 @@ KResult VFS::utime(StringView path, Custody& base, time_t atime, time_t mtime)
auto& inode = *descriptor_or_error.value()->inode();
if (inode.fs().is_readonly())
return KResult(-EROFS);
if (inode.metadata().uid != current->process().euid())
if (!current->process().is_superuser() && inode.metadata().uid != current->process().euid())
return KResult(-EACCES);
int error = inode.set_atime(atime);