1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 02:34:58 +00:00

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

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.