Prechádzať zdrojové kódy

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

Andreas Kling 6 rokov pred
rodič
commit
c9d7fc6ec6
1 zmenil súbory, kde vykonal 1 pridanie a 2 odobranie
  1. 1 2
      Kernel/VirtualFileSystem.cpp

+ 1 - 2
Kernel/VirtualFileSystem.cpp

@@ -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.