Browse Source

LibCore: Fix wrong call to stat on the Core::System::lstat method

We should call lstat and not stat, because lstat gives information on
the symbolic link itself (if the path is about a symbolic link).
Liav A 2 years ago
parent
commit
b4596b48f5
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Userland/Libraries/LibCore/System.cpp

+ 1 - 1
Userland/Libraries/LibCore/System.cpp

@@ -503,7 +503,7 @@ ErrorOr<struct stat> lstat(StringView path)
     HANDLE_SYSCALL_RETURN_VALUE("lstat", rc, st);
     HANDLE_SYSCALL_RETURN_VALUE("lstat", rc, st);
 #else
 #else
     DeprecatedString path_string = path;
     DeprecatedString path_string = path;
-    if (::stat(path_string.characters(), &st) < 0)
+    if (::lstat(path_string.characters(), &st) < 0)
         return Error::from_syscall("lstat"sv, -errno);
         return Error::from_syscall("lstat"sv, -errno);
     return st;
     return st;
 #endif
 #endif