Browse Source

Kernel: Allow sys$rename() to rename symlinks

Previously, this syscall would try to rename the target of the link,
not the link itself.
Andreas Kling 4 years ago
parent
commit
ddaedbca87
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Kernel/FileSystem/VirtualFileSystem.cpp

+ 1 - 1
Kernel/FileSystem/VirtualFileSystem.cpp

@@ -503,7 +503,7 @@ KResult VFS::chmod(StringView path, mode_t mode, Custody& base)
 KResult VFS::rename(StringView old_path, StringView new_path, Custody& base)
 KResult VFS::rename(StringView old_path, StringView new_path, Custody& base)
 {
 {
     RefPtr<Custody> old_parent_custody;
     RefPtr<Custody> old_parent_custody;
-    auto old_custody_or_error = resolve_path(old_path, base, &old_parent_custody);
+    auto old_custody_or_error = resolve_path(old_path, base, &old_parent_custody, O_NOFOLLOW_NOERROR);
     if (old_custody_or_error.is_error())
     if (old_custody_or_error.is_error())
         return old_custody_or_error.error();
         return old_custody_or_error.error();
     auto& old_custody = *old_custody_or_error.value();
     auto& old_custody = *old_custody_or_error.value();