Kernel: chmod() should allow superuser to change mode bits of any file.

This commit is contained in:
Andreas Kling 2019-02-27 12:34:43 +01:00
parent 1d2529b4a1
commit c9d7fc6ec6
Notes: sideshowbarker 2024-07-19 15:36:56 +09:00

View file

@ -300,8 +300,7 @@ KResult VFS::chmod(const String& path, mode_t mode, Inode& base)
if (inode->fs().is_readonly())
return KResult(-EROFS);
// FIXME: Superuser should always be allowed to chmod.
if (current->euid() != inode->metadata().uid)
if (current->euid() != inode->metadata().uid && !current->is_superuser())
return KResult(-EPERM);
// Only change the permission bits.